Ejemplo n.º 1
0
        public void SubmitNewBookCommandAction()
        {
            // do basic validation stuff....
            UpdateNewBookWithNewText();

            string errorMsg;
            bool   isValidBook = IsBookValid(_newBook, out errorMsg);

            if (!isValidBook)
            {
                MessageBox.Show(errorMsg);
                return;
            }

            // add to the list....
            if (!_mainModel.AddNewBook(_newBook, out errorMsg))
            {
                MessageBox.Show(errorMsg);
            }
            else
            {
                InitialiseNewBook();
                _parent.UpdateData();
                OnPropertyChanged("");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The command action to add a new book from the email to the database.
        /// </summary>
        public void AddSelectedBookCommandAction()
        {
            string errorMsg;

            // add to the list....
            if (!_mainModel.AddNewBook(_newBook, out errorMsg))
            {
                MessageBox.Show(errorMsg);
            }
            else
            {
                // remove the selected item from the list
                BooksReadFromEmail.Remove(_selectedBook);

                // reset the new & selected
                NewBook             = null;
                SelectedEmailedBook = null;

                // update the main grid ets
                _parent.UpdateData();
                OnPropertyChanged("");

                OnPropertyChanged(() => BooksReadFromEmail);
                OnPropertyChanged(() => CanAddSelectedBook);
            }
        }