private void btnClearAll_Click(object sender, EventArgs e) { bool board = (tcApp.SelectedIndex == 1); // Board Tab is open -> board=true; Thread tab -> board=false string type = "threads"; if (board) { type = "boards"; } DialogResult dialogResult = MessageBox.Show("Are you sure?", "Clear all " + type, MessageBoxButtons.YesNo); // confirmation prompt if (dialogResult == DialogResult.Yes) { if (board) { ListBoards.Clear(); updateDataSource(typeURL.board); } else { ListThreads.Clear(); updateDataSource(typeURL.thread); } if (General.saveOnClose) { General.writeURLs(ListBoards, ListThreads); } } }
private void btnClearAll_Click(object sender, EventArgs e) { if (tcApp.SelectedIndex > 1) { return; } bool board = (tcApp.SelectedIndex == 1); // Board Tab is open -> board=true; Thread tab -> board=false string type = "threads"; if (board) { type = "boards"; } DialogResult dialogResult = MessageBox.Show("Are you sure you want to clear all " + type + "?", "Clear all " + type, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); // confirmation prompt if (dialogResult == DialogResult.Yes) { if (board) { ListBoards.Clear(); updateDataSource(typeURL.board); } else { ListThreads.Clear(); updateDataSource(typeURL.thread); } if (Properties.Settings.Default.saveOnClose) { General.WriteURLs(ListBoards, ListThreads); } } }