I have a small app(C# WPF) that starts automatically with system, but i want that main window of my program will not shown when it starts from autorun(with command-line parameter autorun).
I written this code:
protected override void OnStartup(StartupEventArgs e)
{
if (e.Args.Length == 0)
this.Run(new MainWindow());
base.OnStartup(e);
}
But it didn't work... So how i can check existence of my autorun parameter from App.xaml.cs and prevent opening MainWindow?
Thanks.
InvalidOperationException