Beispiel #1
0
        // swap EditModel back to ViewModel
        internal void ConfirmEdit(NoteEditModel editedNote)
        {
            editedNote.EditComplete();
            var note = new NoteViewModel(editedNote);

            DisplayNotes[DisplayNotes.IndexOf(editedNote)] = note;
        }
Beispiel #2
0
        private void ProcessCreateNote(string text, NoteViewModel newNote)
        {
            DisplayNotes.Insert(0, newNote);
            var noteCommand = _commandFactory.Create(newNote.Guid, text);

            AddCommand(noteCommand, newNote);
        }
Beispiel #3
0
        public void DeleteNote(Guid guid)
        {
            var noteToDelete = DisplayNotes.Single(w => w.Guid == guid);

            DisplayNotes.Remove(noteToDelete);
            var noteCommand = _commandFactory.Delete(noteToDelete.Guid);

            AddCommand(noteCommand, noteToDelete as NoteModelBase);
        }
        public MainWindow()
        {
            //DetailInvoiceFileModel model = new DetailInvoiceFileModel();
            //Close();

//#if ASDF
            ContractNotesViewModel VM         = new ContractNotesViewModel(1, "Frank");
            DisplayNotes           mainWindow = new DisplayNotes(VM);

            mainWindow.ShowDialog();
//#endif
        }
Beispiel #5
0
 private void ReplayCommand(INoteCommand command)
 {
     if (command is CreateNoteCommand)
     {
         var createNoteCmd = command as CreateNoteCommand;
         var note          = CreateNote(createNoteCmd.Text, createNoteCmd.NoteGuid) as NoteViewModel;
         note.PropertyChanged += Note_PropertyChanged;
     }
     else
     {
         var note = DisplayNotes.Single(w => w.Guid == command.NoteGuid);
         var text = note.Text;
         if (command is InsertTextIntoNoteCommand)
         {
             var insertTextCmd = command as InsertTextIntoNoteCommand;
             InsertText(note, insertTextCmd.Offset, insertTextCmd.Text, true);
         }
         else if (command is DeleteTextFromNoteCommand)
         {
             var deleteTextCmd = command as DeleteTextFromNoteCommand;
             RemoveText(note, deleteTextCmd.Offset, deleteTextCmd.Text, true);
         }
     }
 }
Beispiel #6
0
        internal void EditNote(NoteViewModel note)
        {
            var editNote = new NoteEditModel(note);

            DisplayNotes[DisplayNotes.IndexOf(note)] = editNote;
        }