Esempio n. 1
0
 private void saveChangesButton_Click(object sender, EventArgs e)
 {
     try
     {
         string name      = newFileNameTextbox.Text;
         string author    = newAuthorTextBox.Text;
         bool   isChecked = quotesCheckbox.Checked;
         if (newFileNameTextbox.Text == model.GetName())
         {
             //newFileNameTextbox.Text = "";
             name = null;
         }
         if (newAuthorTextBox.Text == model.GetAuthor())
         {
             //newAuthorTextBox.Text = "";
             author = null;
         }
         //_textController.UpdateText(model, newFileNameTextbox.Text, newAuthorTextBox.Text, quotesCheckbox.Checked);
         _textController.UpdateText(model.GetName(), name, author, quotesCheckbox.Checked);
         form1.updateListViews();
         this.Close();
     }
     catch
     {
         string errorMessage = "You cannot change a text's name to one that already exists";
         var    form2        = new ErrorMessageDisplay(errorMessage);
         form2.Show(this);
     }
 }
Esempio n. 2
0
        public FormPopUpFileEdit(ITextViewModel _model, ITextController textController, IGroupController groupController, Form1 _form1)
        {
            _textController  = textController;
            _groupController = groupController;
            form1            = _form1;
            model            = _model;

            InitializeComponent();

            quotesCheckbox.Checked  = model.GetIncludeQuotes();
            newAuthorTextBox.Text   = model.GetAuthor();
            newFileNameTextbox.Text = model.GetName();
        }