Forum  Core :: SDK (Vi...  Developing the ...  Form Closed Event
Previous Previous
 
Next Next
New Post 11/27/2008 3:41 AM
  santoshreddypadire
3 posts
No Ranking


Form Closed Event 

Is there a Form Closed or webbroser closed events avaliable in these Form.

 
New Post 11/30/2008 12:04 AM
  ori.cohen
4401 posts
1st Level Poster




Re: Form Closed Event 
Hello,

Welcome to Visual WebGui!

As all application that run over the VWG framework are basically web-applications and there is no browser standard for notifying the server that the browser has been closed, the user refreshed the page or that the user moved to a different website, we have no specific way of notifying you which of these three specific events occurred.

In version 6.1.1 we have added an event that is fired when any one of the three previously actions has occurred. You can access this event like so:

public void MyMethod()
{
    Application.ThreadSuspend +=  new EventHandler(Application_ThreadSuspend);
}

void Application_ThreadSuspend(object sender, EventArgs e)
{
    ((IContextTerminate)VWGContext.Current).Terminate(true);
}


Regards,

Ori Cohen
The Visual WebGui team
 
New Post 12/7/2008 12:46 AM
  santoshreddypadire
3 posts
No Ranking


Re: Form Closed Event 

This event only fires on page refresh but not on browser close.

 
New Post 12/7/2008 12:47 AM
  palli
14324 posts
1st Level Poster




Re: Form Closed Event 
Hi !

I don't know how you check for if the event fires. It's is not possible to do that by using MessageBox.Show() as then the thread is allready suspended and the messagebox will never show.

The following VB code on a form, will successfully "log" the suspend event firing:

Imports System.IO

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler Application.ThreadSuspend, AddressOf Application_ThreadSuspend
    End Sub

    Private Sub Application_ThreadSuspend(ByVal sender As Object, ByVal e As EventArgs)
        MessageBox.Show("Thread suspended")
        Dim f As StreamWriter = New StreamWriter("c:\temp\ts.txt")
        f.WriteLine("Thread suspended " + DateTime.Now.ToString())
        f.Close()
    End Sub
End Class

Hope it helps,
Palli

Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Core :: SDK (Vi...  Developing the ...  Form Closed Event
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS