Пример #1
0
 private void ResetHistory(object sender, ExecutedRoutedEventArgs e)
 {
     if (!ConfirmationWindow.Confirm(this, "Reset history for all words?"))
     {
         return;
     }
     CramToolModel.Instance.WordList.ResetHistory();
 }
Пример #2
0
 private void ResetWordHistory(object sender, ExecutedRoutedEventArgs e)
 {
     if (!ConfirmationWindow.Confirm(Window.GetWindow(this), string.Format("Reset history for word '{0}'?", WordInfo.Word.Name)))
     {
         return;
     }
     WordInfo.WordList.ResetWordHistory(WordInfo.Word.Name);
 }
Пример #3
0
        public static bool Confirm(Window owner, string message)
        {
            ConfirmationWindow win = new ConfirmationWindow();

            win.Owner   = owner;
            win.Message = message;

            win.ShowDialog();

            return(win.Result);
        }
Пример #4
0
        private void DeleteRecentFile(object sender, ExecutedRoutedEventArgs e)
        {
            string filename = e.Parameter as string;

            if (filename == null)
            {
                return;
            }

            if (!ConfirmationWindow.Confirm(Window.GetWindow(this), string.Format("Remove file '{0}' from the list of recent files?", filename)))
            {
                return;
            }

            CramToolModel.Instance.DeleteRecentFile(filename);
        }
Пример #5
0
        private bool CheckSaved()
        {
            if (EditableWord == null)
            {
                return(true);
            }
            string name = EditableWord.Name;

            if (string.IsNullOrWhiteSpace(name))
            {
                name = "<unnamed>";
            }
            if (!ConfirmationWindow.Confirm(Window.GetWindow(this), string.Format("Unsaved changes to word '{0}' will be lost.\nAre you sure you want to continue?", name)))
            {
                return(false);
            }
            EditableWord = null;
            return(true);
        }