With this code I can ensure that only one instance of the application is running. But I can not cause the window to be restored from the system tray. I tried window.Show() but not resolve.
public class SingletonApplication : Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
{
public App application { get; private set; }
Telas.wndLogin window;
[STAThread]
public static void Main(string[] args)
{
new SingletonApplication().Run(args);
}
public SingletonApplication()
{
this.IsSingleInstance = true;
}
protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
{
application = new App();
window = new Telas.wndLogin();
application.Run(window);
return false;
}
protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
{
//todo:
}
}