Write code when user close the browser in lightswitch RRS feed

  • Question

  • I'd like to write some code before the user close the browser (to capture the logout time) , and I'm not able to find an event to write my code in , I tried to use Application finalize event , but it's not working.

    I'm using VB lightswitch 2013 desktop client running in browser chrome.

    Tuesday, February 18, 2014 2:16 PM

All replies

  • HI Ahmad

    Could you share your code? we will look into this issue that Application finalize event doesn't work in chrome.



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 19, 2014 11:46 AM
  • Hi Angie,

    I need to update some records in database when the user close the browser, I tried to connect to the database from within the finalize event:

    Protected Overrides Sub Finalize()
        Dim xxx = (From x In Application.Current.CreateDataWorkspace.ApplicationData.LogsSet
                   Where x.User = MyUser
                   Select x)
                   For Each s In testLogin
    End Sub

    But I get the error:

    System.InvalidOperationException: It is not valid to create a Data Workspace on the current thread because it was not created by the LightSwitch runtime.

    Any ideas to solve this problem ?

    Thursday, February 20, 2014 7:51 AM