private void uiBookmarksDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { int col = e.ColumnIndex; if (col < 0) { return; } int rowIndex = e.RowIndex; DataGridViewRow row = uiBookmarksDataGridView.Rows[rowIndex]; string key = ""; switch (col) { case 0: DialogResult dr = MessageBox.Show("This will remove this bookmark. Are you sure?", "Remove Bookmark?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } key = row.Cells[1].Value.ToString(); OsirtHelper.Favourites.Remove(key); uiBookmarksDataGridView.Rows.Remove(row); uiBookmarksDataGridView.Update(); uiBookmarksDataGridView.Refresh(); OsirtHelper.WriteFavourites(); BookmarkRemoved?.Invoke(this, EventArgs.Empty); break; case 2: //click link key = row.Cells[2].Value.ToString(); LinkClicked?.Invoke(this, new TextEventArgs(key)); break; } }
private void CurrentBrowser_AddBookmark(object sender, EventArgs e) { this.InvokeIfRequired(() => OsirtHelper.Favourites[CurrentTab.Browser.Title] = CurrentTab.Browser.URL); OsirtHelper.WriteFavourites(); BookmarkAdded?.Invoke(this, EventArgs.Empty); }