Parse() public static method

Parses command-line arguments.
public static Parse ( IList args ) : CommandLineArguments
args IList The command-line arguments.
return CommandLineArguments
Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        /// <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();
            }
        }
Beispiel #3
0
        /// <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);
        }