/// <summary>
        /// Invoked when a <see cref="MenuItem"/> for a <see cref="TimerWindow"/> is clicked.
        /// </summary>
        /// <param name="sender">The <see cref="MenuItem"/> where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private void WindowMenuItemClick(object sender, EventArgs e)
        {
            MenuItem    windowMenuItem = (MenuItem)sender;
            TimerWindow window         = (TimerWindow)windowMenuItem.Tag;

            window.BringToFrontAndActivate();
        }
Beispiel #2
0
        /// <summary>
        /// Shows a new timer window. The window will run the <see cref="TimerStart"/> specified in the <see
        /// cref="CommandLineArguments"/>, or it will display in input mode if there is no <see cref="TimerStart"/>.
        /// </summary>
        /// <param name="arguments">Parsed command-line arguments.</param>
        private static void ShowNewTimerWindow(CommandLineArguments arguments)
        {
            TimerWindow window = new TimerWindow(arguments.TimerStart);
            window.Options.Set(arguments.GetTimerOptions());
            window.Restore(arguments.GetWindowSize(), RestoreOptions.AllowMinimized);
            window.Show();

            if (window.WindowState != WindowState.Minimized)
            {
                window.BringToFrontAndActivate();
            }
        }
Beispiel #3
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();
            }
        }