// swap EditModel back to ViewModel internal void ConfirmEdit(NoteEditModel editedNote) { editedNote.EditComplete(); var note = new NoteViewModel(editedNote); DisplayNotes[DisplayNotes.IndexOf(editedNote)] = note; }
private void ProcessCreateNote(string text, NoteViewModel newNote) { DisplayNotes.Insert(0, newNote); var noteCommand = _commandFactory.Create(newNote.Guid, text); AddCommand(noteCommand, newNote); }
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 }
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); } } }
internal void EditNote(NoteViewModel note) { var editNote = new NoteEditModel(note); DisplayNotes[DisplayNotes.IndexOf(note)] = editNote; }