public static void Main() { try { EnableLogging(); OpenWcfHost(); CommandLineArgs = Environment.GetCommandLineArgs().OfType <string>().ToList(); var cmdArgs = new CmdLineArgs(Environment.GetCommandLineArgs()); //LogWriter.Info("CommandLine" + cmdArgs.ToString()); if (CommandLineArgs.Contains(AppConstant.installCmd) || CommandLineArgs.Contains(AppConstant.installCmdDefault)) { LogWriter.Info("Contains install cmd"); CreateShortcut(); RunOnStartUp(true); System.Windows.Application.Current.Shutdown(); } if (CommandLineArgs.Contains("--afterinstall")) { string url = BuildLaunchUrl(); Process.Start(url); } LogWriter.Info("Time to start App"); App app = new App(); app.InitializeComponent(); app.Run(); } catch (Exception ex) { LogWriter.Error("Error while starting an app " + ex.Message); } }
protected virtual bool OnInitialize(ReadOnlyCollection <string> commandLineArgs) { if (EnableVisualStyles) { Application.EnableVisualStyles(); } if (!commandLineArgs.Contains("/nosplash") && !CommandLineArgs.Contains("-nosplash")) { ShowSplashScreen(); } m_FinishedOnInitilaize = true; return(true); }
public static bool IsHaveCommandLineArg(string arg) => CommandLineArgs.Contains(arg);