DismissableWarning() public static méthode

public static DismissableWarning ( string warningTitle, string warningMessage, string settingKey ) : bool
warningTitle string
warningMessage string
settingKey string
Résultat bool
Exemple #1
0
 private void LogWindowCloseWithWarning()
 {
     if (UIUtils.DismissableWarning("Closing Window", "The Nano TimeTracker log window is closing, but the program will continue to run - you can start and stop tasks, or open the main window, by clicking on the icon in the tray on the bottom right.", "HideCloseWarning"))
     {
         this.Hide();
     }
 }
Exemple #2
0
        private void LogWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing && !_exiting)
            {
                //behave like Windows Messenger and other systray-based programs, hijack exit for close and explain
                e.Cancel = true;
                LogWindowCloseWithWarning();
            }
            else
            {
                if (UIUtils.DismissableWarning("Exiting Application", "You are exiting the Nano TimeTracker application - to later track time later you will need to start it again. If you just want to hide the window, then cancel here and choose \"Close\" instead.", "HideExitWarning"))
                {
                    if (_taskInProgress)
                    {
                        if (!UIUtils.DismissableWarning("Exiting - Task In Progress", "You are exiting Nano TimeTracker, but you still have a task in progress. The next time you start the application, you will be asked to confirm when that task completed.", "HideExitTaskInProgressWarning"))
                        {
                            //user cancelled on the exit task in progress warning
                            e.Cancel = true;
                        }
                    }
                }
                else
                {
                    //user cancelled on the exit warning
                    e.Cancel = true;
                }
            }

            //assuming we didn't actually exit, reset exiting flag for next time
            if (e.Cancel)
            {
                _exiting = false;
            }
            else
            {
                TaskHotKey.Dispose();
            }
        }