public NoteEditor() { InitializeComponent(); //CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, SaveNote)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, CloseEditor)); InsertAsImgCommand = new NoteFileCommand(InsertNoteFileAsImg); InsertAsMdCommand = new NoteFileCommand(InsertNoteFileAsMd); _messageClearTimer = new DispatcherTimer(); _messageClearTimer.Tick += ClearMessage; _messageClearTimer.Interval = TimeSpan.FromMilliseconds(2500); _documentEntitiys = new List <DocumentEntitiy>(); var documentEntitiesTimer = new DispatcherTimer(); documentEntitiesTimer.Tick += UpdateDocumentEntities; documentEntitiesTimer.Interval = TimeSpan.FromMilliseconds(1000); documentEntitiesTimer.Start(); Closing += NoteEditorClosing; MarkdownText.Focus(); }
public NoteEditorViewModel(Note note) { Note = note; Text = Note.DecryptedText; NoteFiles = new BoundObservableCollection <NoteFileViewModel, NoteFile>(Note.Files, nf => new NoteFileViewModel(nf), (vm, m) => vm.NoteFile == m); AddNoteFileCommand = new NoteFileCommand(AddNoteFile); DeleteNoteFileCommand = new NoteFileCommand(DeleteNoteFile); //WeakEventManager<NoteEditorViewModel, NoteFileEventArgs>.AddHandler(this, "NoteFileDeleted", null); }