/// <summary> /// Handles the Click event of the Show Bookmarked Issues button. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnShowBookmarked_Click(object sender, EventArgs e) { // for each control in the area panel, if it's a checkbox, uncheck it // since the form will be showing bookmarks and no selected issues foreach (Control control in areaPanel.Controls) { if (control is CheckBox) { CheckBox box = (CheckBox)control; box.Checked = false; } } // make sure select all button currently says select all since everything has been unchecked btnSelectAll.Text = "Select All"; // disable the show bookmarks button since we're already viewing bookmarks btnShowBookmarked.Enabled = false; // suspend painting for the preview panel DrawingControl.SuspendDrawing(panelPreview); // update the controls on the preview panel panelPreview_Update(true); // let the preview panel resume painting DrawingControl.ResumeDrawing(panelPreview); // refresh the preview panel to show updates panelPreview.Refresh(); }
/// <summary> /// Handles the Checked event of any checked area box. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void anyBox_Checked(object sender, EventArgs e) { // update list of all checked boxes this.getCheckedBoxes(); // we're not looking at bookmarks anymore showingBookmarks = false; btnShowBookmarked.Enabled = true; // suspend drawing for the moment while updating panel controls (avoids undefined behavior) DrawingControl.SuspendDrawing(panelPreview); // update panel controls, specifying that we are not looking at bookmarked issues panelPreview_Update(false); // allow the panel to resume drawing DrawingControl.ResumeDrawing(panelPreview); // refresh the panel to see updated controls panelPreview.Refresh(); }
/// <summary> /// Handles the Click event of the btnSelectAll control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnSelectAll_Click(object sender, EventArgs e) { showingBookmarks = false; btnShowBookmarked.Enabled = true; // Suspend drawing to allow the panel to update controls (avoids undefined behavior) DrawingControl.SuspendDrawing(panelPreview); // if all are not already selected, select them all and change button text to clear all if (!selectedAll) { // for each control in the panel, if it's a checkbox, check it foreach (Control control in areaPanel.Controls) { if (control is CheckBox) { CheckBox box = (CheckBox)control; box.Checked = true; } } // change button text to clear all btnSelectAll.Text = "Clear All"; } // if all are already selected, this button functions as a clear button if (selectedAll) { // for each control, if it is a checkbox, clear it foreach (Control control in areaPanel.Controls) { if (control is CheckBox) { CheckBox box = (CheckBox)control; box.Checked = false; } } // change button text to select all btnSelectAll.Text = "Select All"; } // switch the bool value for all selected to the opposite of what it was selectedAll = !selectedAll; // reinstate drawing for the preview panel DrawingControl.ResumeDrawing(panelPreview); }
/// <summary> /// Handles the Click event of the Bookmark/Remove Bookmark button. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnStar_Click(object sender, EventArgs e) { // if the current issue being viewed is already bookmarked, if (focus.getBookmarked()) { // set it to be not bookmarked and change text of button to say bookmark focus.setBookmarked(false); btnStar.Text = "Bookmark this Issue"; // if currently viewing bookmarks, update the preview panel if (showingBookmarks) { // suspend painting of preview panel for a moment to prevent weird behavior DrawingControl.SuspendDrawing(panelPreview); // update controls of the preview panel panelPreview_Update(true); // tell the preview panel it can resume painting DrawingControl.ResumeDrawing(panelPreview); // refresh the preview panel to see changes panelPreview.Refresh(); // since bookmark has been removed for the focus issue, // remove it from the browser and set the browser to blank page browseWindow.Navigate("about:blank"); // set focus to null since we aren't focusing on an issue now focus = null; } } // if the current issue being viewed is not bookmarked, bookmark it and change the button // to remove bookmark else { focus.setBookmarked(true); btnStar.Text = "Remove Bookmark"; } }