public void CheckChangedDataEntry(object input) { BookmarkBox current_bookmark_box = input as BookmarkBox; // If Bookmarks contains the input remove it if (_bookmarks.Exists(el => el.Name == current_bookmark_box.Bookmark.Name)) { try { int index = _bookmarks.FindIndex(el => el.Name == current_bookmark_box.Bookmark.Name); _bookmarks.RemoveAt(index); } catch (Exception e) { new BugTracker().Track("Bookmark Manager (Data Entry)", "Remove article from bookmark", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } } // If Bookmarks doesn't contain the input add it else { try { _bookmarks.Add(current_bookmark_box.Bookmark); } catch (Exception e) { new BugTracker().Track("Bookmark Manager (Data Entry)", "Add article to bookmark", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } } }
private void ItemsSource_Filter(object sender, FilterEventArgs e) { // Edge case: filter text is empty if (string.IsNullOrWhiteSpace(FilterText)) { e.Accepted = true; return; } e.Accepted = false; // BookmarkBox if (e.Item is BookmarkBox) { BookmarkBox current = e.Item as BookmarkBox; if (current.Bookmark.Name.ToUpper().Contains(FilterText.ToUpper())) { e.Accepted = true; } } // ReferenceBox else if (e.Item is ReferenceBox) { ReferenceBox current = e.Item as ReferenceBox; if (current.Reference.Name.ToUpper().Contains(FilterText.ToUpper())) { e.Accepted = true; } } // Bookmark else if (e.Item is Bookmark) { Bookmark current = e.Item as Bookmark; if (current.Name.ToUpper().Contains(FilterText.ToUpper())) { e.Accepted = true; } } // Reference else if (e.Item is Reference) { Reference current = e.Item as Reference; if (current.Name.ToUpper().Contains(FilterText.ToUpper())) { e.Accepted = true; } } else { throw new ArgumentException("Invalid argument type!"); } }
public void CheckChangedDataView(object input) { BookmarkBox current_bookmark_box = input as BookmarkBox; // 1. If user checked add article to bookmark if (current_bookmark_box.IsChecked) { try { new BookmarkRepo().AddArticleToBookmark(current_bookmark_box.Bookmark, _article); // Track Couple info = new Couple("Bookmark", "Add", _article.Title, current_bookmark_box.Bookmark.Name); new Tracker(User).TrackCoupling <Couple>(info); } catch (Exception e) { new BugTracker().Track("Bookmark Manager", "Add article to bookmark", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } } // 2. If user unchecked remove article from bookmark else { try { new BookmarkRepo().RemoveArticleFromBookmark(current_bookmark_box.Bookmark, _article); // Track Couple info = new Couple("Bookmark", "Remove", _article.Title, current_bookmark_box.Bookmark.Name); new Tracker(User).TrackCoupling <Couple>(info); } catch (Exception e) { new BugTracker().Track("Bookmark Manager", "Remove article from bookmark", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } } }
protected override void VisitBookmarkStartBox(BookmarkBox bookmarkStartBox) { TryAddElementToCollection(bookmarkStartBox, ContentDisplayAction.Select, false); base.VisitBookmarkStartBox(bookmarkStartBox); }
protected override void VisitBookmarkStartBox(BookmarkBox bookmarkStartBox) { AddTreeNode(bookmarkStartBox, ContentDisplayAction.Select); base.VisitBookmarkStartBox(bookmarkStartBox); }