private void FilterNotes(string searchText)
        {
            ArchivedNotes.Clear();

            if (searchText == string.Empty)
            {
                ArchivedNotes.AddRange(shadowNotes.OrderByDescending(x => x.ArchivedDate));
            }
            else
            {
                var matches = shadowNotes.Select(x =>
                {
                    short score = 0;
                    if (x.Name.ToLowerInvariant().Contains(searchText))
                    {
                        score += 2;
                    }
                    if (x.Content.ToLowerInvariant().Contains(searchText))
                    {
                        score += 1;
                    }

                    return(new { Score = score, Note = x });
                })
                              .Where(x => x.Score > 0)
                              .OrderByDescending(x => x.Score)
                              .ThenByDescending(x => x.Note.ArchivedDate)
                              .Select(x => x.Note);

                ArchivedNotes.AddRange(matches);
            }
        }
        private void ClearSearch()
        {
            SearchText = string.Empty;

            ArchivedNotes.Clear();
            ArchivedNotes.AddRange(shadowNotes.OrderByDescending(x => x.ArchivedDate));

            previousSearchText = string.Empty;
        }
        public ArchivedNotesViewModel(INotesService notesService)
        {
            _notesService           = notesService;
            _notesService.Archived += NoteArchived;
            _notesService.Restored += NoteRestored;
            _notesService.Deleted  += NoteDeleted;

            var archived = _notesService.LoadArchived();

            archivedNotesExist = archived.Any();
            searchFieldEnabled = archived.Length > 1;

            var viewModels = archived.Select(x => new ArchivedNoteViewModel(x));

            ArchivedNotes.AddRange(viewModels);

            shadowNotes = viewModels.ToList();

            OnRestoreCommand     = ReactiveCommand.Create(RestoreSelectedNote);
            OnDeleteCommand      = ReactiveCommand.Create(DeleteSelectedNote);
            OnConfirmCommand     = ReactiveCommand.Create(ConfirmDelete);
            OnCancelCommand      = ReactiveCommand.Create(CancelDelete);
            OnClearSearchCommand = ReactiveCommand.Create(ClearSearch);
        }