private void NewNote(NoteType noteType) { Modified = true; ClearFilter(); // Create new note and update model list NoteModel noteModel = new NoteModel(); noteModel.NoteType = noteType; noteModel.BackgroundColorHex = _settingsService.LoadSettingsOrDefault().DefaultNoteColorHex; // Update view model list NoteViewModel noteViewModel = new NoteViewModel(_navigationService, Language, Icon, Theme, _webviewBaseUrl, _searchableTextConverter, _repositoryService, _feedbackService, null, _noteCryptor, _model.Safes, _model.CollectActiveTags(), noteModel); NoteInsertionMode insertionMode = _settingsService.LoadSettingsOrDefault().DefaultNoteInsertion; switch (insertionMode) { case NoteInsertionMode.AtTop: var lastPinned = AllNotes.LastOrDefault(x => x.IsPinned == true); var index = lastPinned == null ? 0 : AllNotes.IndexOf(lastPinned) + 1; _model.Notes.Insert(index, noteModel); AllNotes.Insert(index, noteViewModel); break; case NoteInsertionMode.AtBottom: _model.Notes.Add(noteModel); AllNotes.Add(noteViewModel); break; default: throw new ArgumentOutOfRangeException(nameof(insertionMode)); } ShowNoteCommand.Execute(noteViewModel.Id); }
private void NewNote(NoteType noteType) { Modified = true; ClearFilter(); // Create new note and update model list NoteModel noteModel = new NoteModel(); noteModel.NoteType = noteType; noteModel.HtmlContent = "<h1> </h1>"; // Start with header format. noteModel.BackgroundColorHex = _settingsService.LoadSettingsOrDefault().DefaultNoteColorHex; // Update view model list NoteViewModel noteViewModel = new NoteViewModel(_navigationService, Language, Icon, Theme, _webviewBaseUrl, _searchableTextConverter, _repositoryService, _feedbackService, null, _noteCryptor, _model.Safes, noteModel); NoteInsertionMode insertionMode = _settingsService.LoadSettingsOrDefault().DefaultNoteInsertion; switch (insertionMode) { case NoteInsertionMode.AtTop: _model.Notes.Insert(0, noteModel); AllNotes.Insert(0, noteViewModel); FilteredNotes.Insert(0, noteViewModel); break; case NoteInsertionMode.AtBottom: _model.Notes.Add(noteModel); AllNotes.Add(noteViewModel); FilteredNotes.Add(noteViewModel); break; default: throw new ArgumentOutOfRangeException(nameof(insertionMode)); } ShowNote(noteViewModel.Id); }