public void ShowEditor(int?bookmarkIdToEdit) { if (bookmarkIdToEdit == null) { bookmark = new BookmarkDto(); // If we are creating a new entry then check the clipboard, there might be // something copied there that we can auto-paste into the url field. var clipboardUrl = ClipboardUtil.GetUrlFromClipboard(checkFormat: true); if (!string.IsNullOrWhiteSpace(clipboardUrl)) { bookmark.Url = clipboardUrl; } } else { bookmark = DataProvider.DataStore.Value.Bookmarks.Value.Get(bookmarkIdToEdit.Value); } RenderBookmark(); this.ShowDialog(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Topmost = true; //BookmarkTestData.InsertTestRecords(); // Uncomment to create test records // Get db tables/cache loaded up as fast as possible so UI is more snappy on the first db hit. DataProvider.DataStore.Value.Bookmarks.Value.TagsSearch("#pre-cache#"); CenterWindowOnScreen(); CreateSearchBoxContextMenu(); RegisterActivationHotkey(); // If there is a URL on the clipboard, do a search for it. This makes it faster to edit an // already existing bookmark in the database. // re:(checkFormat=false) Searching for any url string isn't harmful, so there isn't any validation on // if it contains http or something. var clipboardUrl = ClipboardUtil.GetUrlFromClipboard(checkFormat: false); if (!string.IsNullOrWhiteSpace(clipboardUrl)) { SearchForBookmark(clipboardUrl); } txtSearch.Focus(); }