コード例 #1
0
        private bool ConfirmChangesSaved()
        {
            WordList wordList = CramToolModel.Instance.WordList;

            if (wordList == null || !wordList.Modified)
            {
                return(true);
            }
            UnsavedChangesWindow win = new UnsavedChangesWindow();

            win.Owner   = this;
            win.Message = string.Format("Do you want to save changes to {0}?", CramToolModel.Instance.ShortDictPath);
            win.ShowDialog();

            UnsavedChangesHandling result = win.Result;

            if (result == UnsavedChangesHandling.Cancel)
            {
                return(false);
            }
            if (result == UnsavedChangesHandling.Ignore)
            {
                return(true);
            }
            try
            {
                return(SaveDictionary());
            }
            catch (Exception e)
            {
                App.HandleException(this, e);
                return(false);
            }
        }
コード例 #2
0
        private bool ConfirmChangesSaved()
        {
            WordList wordList = CramToolModel.Instance.WordList;
            if (wordList == null || !wordList.Modified)
            {
                return true;
            }
            UnsavedChangesWindow win = new UnsavedChangesWindow();
            win.Owner = this;
            win.Message = string.Format("Do you want to save changes to {0}?", CramToolModel.Instance.ShortDictPath);
            win.ShowDialog();

            UnsavedChangesHandling result = win.Result;
            if (result == UnsavedChangesHandling.Cancel)
            {
                return false;
            }
            if (result == UnsavedChangesHandling.Ignore)
            {
                return true;
            }
            try
            {
                return SaveDictionary();
            }
            catch (Exception e)
            {
                App.HandleException(this, e);
                return false;
            }
        }