private bool EnsureSaved()
        {
            if (AppState.Program == null ||
                AppState.Program.IsModified == false)
            {
                return(true);
            }

            string fileName = "Untitled";

            if (AppState.Program != null &&
                !string.IsNullOrEmpty(AppState.Program.FileName))
            {
                fileName = Path.GetFileName(AppState.Program.FileName);
            }

            SavePromptDialog dialog = new SavePromptDialog();

            dialog.Message = string.Format("Do you want to save {0}?", fileName);
            dialog.Owner   = this;
            SavePromptDialogResults result = dialog.ShowDialog();

            if (result == SavePromptDialogResults.Cancel)
            {
                return(false);
            }

            if (result == SavePromptDialogResults.Save)
            {
                if (!Save(true))
                {
                    return(false);
                }

                return(true);
            }

            // Unknown result...
            //
            return(true);
        }
示例#2
0
        void OnBtnCancelClick(object sender, RoutedEventArgs e)
        {
            _result = SavePromptDialogResults.Cancel;

            Close();
        }
示例#3
0
 void OnBtnContinueClick(object sender, RoutedEventArgs e)
 {
     _result = SavePromptDialogResults.Continue;
     Close();
 }
示例#4
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            m_result = SavePromptDialogResults.Cancel;

            Close();
        }
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            m_result = SavePromptDialogResults.Cancel;

            Close();
        }
        void OnBtnCancelClick(object sender, RoutedEventArgs e)
        {
            _result = SavePromptDialogResults.Cancel;

            Close();
        }
 void OnBtnContinueClick(object sender, RoutedEventArgs e)
 {
     _result = SavePromptDialogResults.Continue;
     Close();
 }