Example #1
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (!_viewModel.IsValid)
            {
                MessageBox.Show(GuiStrings.NewFileBox_CreateButton_FileNameValidationErrorMessage,
                                GuiStrings.NewFileBox_CreateButton_FileNameValidationErrorTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Action = CreateFileAction.Cancel;
            }

            if (_viewModel.FileAlreadyExists)
            {
                var res = MessageBox.Show(this,
                                          string.Format(GuiStrings.NewFileBox_CreateButton_FileAlreadyExistsMessage, _viewModel.FilePath),
                                          GuiStrings.NewFileBox_CreateButton_FileAlreadyExistsTitle, MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Exclamation);
                if (res == DialogResult.No)
                {
                    return;
                }
            }

            _viewModel.CreateNewFile();
            Action = CreateFileAction.Created;
            Close();
        }
Example #2
0
 private void CancelButton_Click(object sender, EventArgs e)
 {
     Action = CreateFileAction.Cancel;
     Close();
 }