public static ShowUsage ( string errorMessage = null ) : void | ||
errorMessage | string | An error message to display. (Optional.) |
리턴 | void |
/// <summary> /// Invoked when a subsequent instance of this application starts. /// </summary> /// <param name="e">Contains the command-line arguments of the subsequent application instance and indicates /// whether the first application instance should be brought to the foreground.</param> protected override void OnStartupNextInstance(StartupNextInstanceEventArgs e) { CommandLineArguments arguments = CommandLineArguments.Parse(e.CommandLine); if (arguments.ShouldShowUsage || arguments.HasParseError) { CommandLineArguments.ShowUsage(arguments.ParseErrorMessage); return; } SetGlobalSettingsFromArguments(arguments); ShowTimerWindowsForArguments(arguments); }
/// <summary> /// Invoked when a subsequent instance of this application starts. /// </summary> /// <param name="e">Contains the command-line arguments of the subsequent application instance and indicates /// whether the first application instance should be brought to the foreground.</param> protected override void OnStartupNextInstance(StartupNextInstanceEventArgs e) { CommandLineArguments arguments = CommandLineArguments.Parse(e.CommandLine); if (arguments.ShouldShowUsage || arguments.HasParseError) { CommandLineArguments.ShowUsage(arguments.ParseErrorMessage); return; } SetGlobalSettingsFromArguments(arguments); TimerWindow window = GetTimerWindowFromArguments(arguments); window.Show(); if (window.WindowState != WindowState.Minimized) { window.BringToFrontAndActivate(); } }
/// <summary> /// Invoked when the application starts. /// </summary> /// <param name="e">Contains the command-line arguments of the application and indicates whether the /// application startup should be canceled.</param> /// <returns>A value indicating whether the application should continue starting up.</returns> protected override bool OnStartup(StartupEventArgs e) { AppManager.Instance.Initialize(); CommandLineArguments arguments = CommandLineArguments.Parse(e.CommandLine); if (arguments.ShouldShowUsage || arguments.HasParseError) { CommandLineArguments.ShowUsage(arguments.ParseErrorMessage); AppManager.Instance.Dispose(); return(false); } SetGlobalSettingsFromArguments(arguments); TimerWindow window = GetTimerWindowFromArguments(arguments); this.app = new App(); this.app.Exit += AppExit; this.app.Run(window); return(false); }