void ModifyCore(BookmarkAndSettings[] settings) { uiDispatcher.VerifyAccess(); var bms = new List <BookmarkAndOldSettings>(settings.Length); lock (lockObj) { foreach (var info in settings) { var bmImpl = info.Bookmark as BookmarkImpl; Debug.Assert(!(bmImpl is null)); if (bmImpl is null) { continue; } Debug.Assert(bookmarks.Contains(bmImpl)); if (!bookmarks.Contains(bmImpl)) { continue; } var currentSettings = bmImpl.Settings; if (currentSettings == info.Settings) { continue; } bms.Add(new BookmarkAndOldSettings(bmImpl, currentSettings)); bmImpl.WriteSettings_BMThread(info.Settings); } } if (bms.Count > 0) { BookmarksModified?.Invoke(this, new BookmarksModifiedEventArgs(new ReadOnlyCollection <BookmarkAndOldSettings>(bms))); } }
public void Clear(bool dontInvokeBookmarksModified = false) { if (bookmarks != null) { bookmarks.Clear(); } if (!dontInvokeBookmarksModified) { BookmarksModified?.Invoke(); } }
public void AddRange(IEnumerable <Bookmark> bookmarksToAdd) { if (bookmarks == null) { bookmarks = new List <Bookmark>(); } foreach (var bookmark in bookmarksToAdd) { if (!bookmarks.Any(bm => bm.Name == bookmark.Name && bm.URI == bookmark.URI)) { bookmarks.Add(bookmark); System.Diagnostics.Debug.WriteLine("Bookmark added"); } } BookmarksModified?.Invoke(); }
public void Remove(Bookmark bookmark) { bookmarks.Remove(bookmark); BookmarksModified?.Invoke(); }
public void Swap(int index, int newIndex) { bookmarks.Swap(index, newIndex); BookmarksModified?.Invoke(); }