public partial class App : System.Windows.Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var args = e.Args;
if(args.Length!=0)
{
if (args[0] == ("login"))
{
new LoginWindow().Show();//conduct the login procedure
}
if (args[0] == ("restart"))
{
new SmallPanelWindow(2).Show();
}
}
else
{
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--proxy-server=\"direct://\"");
new MainWindow().Show();//show mainwindow which is commonly used
}
}
How can I ensure the LoginWindow exist only one at a time when the program is called with parameter "login" for multiple times?(eg. different triggers in windows TaskScheduler call the program with "login")Also, Starting Mainwindow can't be affected.