Exemplo n.º 1
0
        /// <summary>
        /// Invoked when the "New timer" <see cref="MenuItem"/> 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 NewTimerMenuItemClick(object sender, RoutedEventArgs e)
        {
            TimerWindow window = new TimerWindow();

            window.RestoreFromWindow(this.timerWindow);
            window.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Invoked when the "New timer" <see cref="MenuItem"/> 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 NewTimerMenuItemClick(object sender, EventArgs e)
        {
            TimerWindow window = new TimerWindow();

            window.RestoreFromSibling();
            window.Show();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            Application.Init();
            TimerWindow win = new TimerWindow();

            win.Show();
            Application.Run();
        }
Exemplo n.º 4
0
        private void OnStartTimer()
        {
            Window w = new TimerWindow();
            TimerWindowViewModel vm = ContainerHelper.Container.Resolve <TimerWindowViewModel>();

            w.DataContext = vm;
            w.Show();
        }
Exemplo n.º 5
0
        public void Execute(object parameter)
        {
            var singleViewWindow = new TimerWindow(trackers);

            singleViewWindow.Show();

            ((Window)parameter).Close();
        }
Exemplo n.º 6
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();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Shows an existing <see cref="Timer"/> in a new <see cref="TimerWindow"/>.
        /// </summary>
        /// <param name="savedTimer">An existing <see cref="Timer"/>.</param>
        private void ShowSavedTimerInNewWindow(Timer savedTimer)
        {
            TimerWindow newTimerWindow = new TimerWindow();

            if (savedTimer.Options.WindowSize != null)
            {
                newTimerWindow.Restore(savedTimer.Options.WindowSize);
            }
            else
            {
                newTimerWindow.RestoreFromWindow(this.timerWindow);
            }

            newTimerWindow.Show(savedTimer);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Shows windows for all saved timers.
        /// </summary>
        /// <param name="arguments">Parsed command-line arguments.</param>
        private static void ShowSavedTimerWindows(CommandLineArguments arguments)
        {
            foreach (Timer savedTimer in TimerManager.Instance.ResumableTimers)
            {
                TimerWindow window = new TimerWindow();

                if (savedTimer.Options.WindowSize != null)
                {
                    window.Restore(savedTimer.Options.WindowSize, RestoreOptions.AllowMinimized);
                }
                else
                {
                    window.Restore(arguments.GetWindowSize(), RestoreOptions.AllowMinimized);
                }

                window.Show(savedTimer);
            }
        }
Exemplo n.º 9
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();
            }
        }