private void ActionSelectionChanged(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection indexCollection = actionsCheckedListBox.CheckedIndices; this.actionsSelectionLabel.Text = string.Empty; this.actionTypeSelection = ActionTypes.None; foreach (int index in indexCollection) { switch (index) { case (0): this.actionsSelectionLabel.Text += "Send Auto-Reply Email to Sender\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.SendAutoReply; break; case (1): this.actionsSelectionLabel.Text += "Create Outlook Note\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.CreateNote; break; case (2): this.actionsSelectionLabel.Text += "Create Outlook Task\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.CreateTask; break; } } this.BuildWorkflow(WizardStep.Condition); ResetButtons(); }
private void FormSpecificDialog_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { if (string.IsNullOrWhiteSpace(txtValue.Text)) { MessageBox.Show("This field cannot be blank."); txtValue.Focus(); e.Cancel = true; return; } currentForm.Name = txtValue.Text; CheckedListBox.CheckedIndexCollection selectedItems = chkChooseIdentifier.CheckedIndices; if (selectedItems.Count > 0) { Field field = (Field)chkChooseIdentifier.Items[selectedItems[0]]; currentForm.IdentifierFieldId = new FieldId(field.PageNumber, field.Name); } else { currentForm.IdentifierFieldId = new FieldId(-1, ""); } } }
public void CheckedListBox_CheckedIndexCollectionNotNull() { var box = new CheckedListBox(); CheckedListBox.CheckedIndexCollection collection = box.CheckedIndices; Assert.NotNull(collection); }
private bool ValidateCertificateCheckListBox() { CheckedListBox.CheckedIndexCollection coll = certificates_checkedListBox.CheckedIndices; if (coll.Count == 0) { return(false); } return(true); }
public static int[] createArrayIndex(CheckedListBox.CheckedIndexCollection collection) { int[] arr = new int[collection.Count]; for (var x = 0; x < arr.Length; x++) { arr[x] = collection[x]; } return(arr); }
private void buttonConvert_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection checkedIndices = this.checkedListBox.CheckedIndices; for (int num = 0; num != checkedIndices.Count; num++) { this.converter.column[checkedIndices[num]].selected = true; } this.converter.Save_XML(this.textBoxOutputPath.Text); this.buttonConvert.Text = "Done!"; }
private void btnCompare_Click(object sender, EventArgs e) { if (csv != null) { CheckedListBox.CheckedIndexCollection col = checkedListBoxFeatureVector.CheckedIndices; csv.GivenDataIndex = col[0]; csv.CompareDataIndex = col[1]; csv.update(); } }
private void button1_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection selectedItems = checkedListBox1.CheckedIndices; if (selectedItems.Count > 0) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { button1.Enabled = false; filesToDownload = 0; fileDownloadCount = 0; for (int f = 0; f < selectedItems.Count; f++) { char delimiter = '/'; string[] splitWords = fileList[selectedItems[f]].Split(delimiter); string localFilePath = folderBrowserDialog1.SelectedPath + "//" + splitWords[splitWords.Length - 1]; if (File.Exists(localFilePath)) { if (MessageBox.Show(checkedListBox1.Items[selectedItems[f]] + " already exists at this location.\nOverwrite existing file?", "Confirm File Replace", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { continue; } } //spawn requests for file download filesToDownload++; if (checkedListBox1.Items[selectedItems[f]] == autoLoadComboBox.Items[autoLoadComboBox.SelectedIndex]) { autoLoadFilePath = localFilePath; } try { FtpWebRequest webRequest = (FtpWebRequest)WebRequest.Create(fileList[selectedItems[f]]); webRequest.Method = WebRequestMethods.Ftp.DownloadFile; // RequestState is a custom class to pass info to the callback RequestState2 rs2 = new RequestState2(); rs2.index = selectedItems[f]; rs2.Request = webRequest; IAsyncResult result2 = webRequest.BeginGetResponse(new AsyncCallback(FileDownloadCallback), rs2); ThreadPool.RegisterWaitForSingleObject(result2.AsyncWaitHandle, new WaitOrTimerCallback(InfoseekTimeout), rs2, (30 * 1000), // 30 second timeout true ); } catch (WebException we) { MessageBox.Show(we.Message, "Connection Error", MessageBoxButtons.OK); button1.Enabled = true; } } toolStripStatusLabel1.Text = "Downloading " + filesToDownload.ToString() + " files..."; } } }
public void ProcessUninstallMod(ModEntry mod)// command-line uninstall. This checks the mod it was passed, and puts it in a 1-item list to be uninstalled. { for (int i = 0; i < listInstalledMods.Items.Count; i++) { listInstalledMods.SetItemCheckState(i, CheckState.Unchecked); } var mods = manager.GetInstalledMods(); listInstalledMods.SetItemCheckState(mods.IndexOf(mod), CheckState.Checked); CheckedListBox.CheckedIndexCollection checkedModIndex = listInstalledMods.CheckedIndices; ProgressWindow.Show("Uninstalling Mod", "Uninstalling...", new Action((MethodInvoker) delegate { ModManager.UninstallMod(checkedModIndex); })); }
private void ChkListEspecialidades_SelectedIndexChanged(object sender, EventArgs e) { // Get the items that are selected CheckedListBox.CheckedIndexCollection selectedItems = this.ChkListEspecialidades.CheckedIndices; // Check that we have at least 1 item selected if (selectedItems.Count > 0) { // Uncheck the other item this.ChkListEspecialidades.SetItemChecked(selectedItems[0], false); } }
private object ExtractIntFromCheckedListBox(CheckedListBox checkedListBox) { CheckedListBox.CheckedIndexCollection indices = checkedListBox.CheckedIndices; int intValue = 0; foreach (int index in indices) { intValue |= m_values[index]; } return(intValue); }
private void pokesListBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.NewValue != CheckState.Checked) { CheckedListBox.CheckedIndexCollection selectedItems = pokesListBox.CheckedIndices; if (selectedItems.Count == 1) { button1.Enabled = false; return; } } button1.Enabled = true; }
// if a user checks more than one item, uncheck the previous one private void chkChooseIdentifier_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.NewValue != CheckState.Checked) { return; } CheckedListBox.CheckedIndexCollection selectedItems = chkChooseIdentifier.CheckedIndices; if (selectedItems.Count > 0) { chkChooseIdentifier.SetItemChecked(selectedItems[0], false); } }
private void btnDeleteCars_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection checkedItems = checkedList.CheckedIndices; foreach (int index in checkedItems) { checkedList.Items.RemoveAt(index); if (this.Text == "Car List") { carList.RemoveAt(index); } else { houseList.RemoveAt(index); } } }
private void GetTblDatabackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { if (((this.instances != null) && (this.instances.Length != 0)) && (this.tablesTotalLines[this.current_table_id] != 0)) { values.Clear(); CheckedListBox.CheckedIndexCollection checkedIndices = this.tableStructure.CheckedIndices; if (checkedIndices.Count != 0) { int num2 = int.Parse(this.fetchSize.Text); int num5 = int.Parse(this.fetchStart.Text); int num6 = num5 + num2; float num7 = 0f; int index = 0; string[] row; string[] strArray4; headers = new string[checkedIndices.Count]; int k = 0; for (k = 0; k < checkedIndices.Count; k++) { index = checkedIndices[k]; headers[k] = names[index]; } for (int j = num5; j < num6; j++) { row = new string[checkedIndices.Count]; this._connector.Table().ReadLine(this.instances[this.current_table_id], j.ToString(), headers); for (k = 0; k < checkedIndices.Count; k++) { strArray4 = this._connector.GetDataByName(headers[k].ToLower(), -1); if (strArray4 != null) { row[k] = strArray4[0]; } else { row[k] = " "; } } values.Add(row); num7 = (((float)(j - num5)) / ((float)(num6 - num5))) * 100f; GetTblDatabackgroundWorker.ReportProgress((int)num7); } } } }
private void languageListBox_ItemCheck(object sender, ItemCheckEventArgs e) { // Ensure that we are checking an item if (e.NewValue != CheckState.Checked) { return; } // Get the items that are selected CheckedListBox.CheckedIndexCollection selectedItems = this.languageListBox.CheckedIndices; // Check that we have at least 1 item selected if (selectedItems.Count > 0) { // Uncheck the other item this.languageListBox.SetItemChecked(selectedItems[0], false); } validateLanguageButton.Focus(); }
//对比功能 private void toolStripButton1_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection checkeds = hisListBox1.CheckedIndices; if (checkeds.Count == 2) { JsonObjectTree tree1 = hisJsonMap[hisStringList[checkeds[0]]]; JsonObjectTree tree2 = hisJsonMap[hisStringList[checkeds[1]]]; CheckedListBox.CheckedItemCollection items = hisListBox1.CheckedItems; KeyValuePair <string, JsonObjectTree>[] data = new KeyValuePair <string, JsonObjectTree>[] { new KeyValuePair <string, JsonObjectTree>((string)items[0], tree1), new KeyValuePair <string, JsonObjectTree>((string)items[1], tree2) }; new CompareWindow(data).Show(); } else { MessageBox.Show("请选择两条记录"); } }
private void Certificates_CheckChanged(object sender, ItemCheckEventArgs e) { if (e.NewValue == CheckState.Checked) { CheckedListBox.CheckedIndexCollection coll = certificates_checkedListBox.CheckedIndices; foreach (int index in coll) { certificates_checkedListBox.SetItemCheckState(index, CheckState.Unchecked); } foreach (string item in certificates_checkedListBox.CheckedItems) { string certificateName = item; _certificateInstallerActivityData.CACertificate = certificateName; } } }
private void ExportItems(string exportPath, CheckedListBox.CheckedIndexCollection checkedIndices) { string resultString = ""; foreach (int checkedIndex in checkedIndices) { resultString += configurations.configurations[checkedIndex]; } if (File.Exists(exportPath) == true) { File.Delete(exportPath); } StreamWriter output = File.CreateText(exportPath); output.Write(resultString); output.Close(); }
private void buttonUninstall_Click(object sender, EventArgs e) //sends checked indices to ModManager for uninstallation. { // Get the indices of all checked mods, and their names. CheckedListBox.CheckedIndexCollection checkedModIndices = listInstalledMods.CheckedIndices; CheckedListBox.CheckedItemCollection checkedModItems = listInstalledMods.CheckedItems; string markedModNames = ""; foreach (object mod in checkedModItems) { markedModNames += "\n" + mod.ToString(); } if (!(MessageBox.Show("The following mods will be uninstalled:\n" + markedModNames, "SnakeBite", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)) { return; } ProgressWindow.Show("Uninstalling Mod(s)", "Uninstalling...\n\nNote:\nThe uninstall time depends greatly on\nthe mod's contents, the number of mods being uninstalled\nand the mods that are still installed.", new Action((MethodInvoker) delegate { ModManager.UninstallMod(checkedModIndices); })); // Update installed mod list RefreshInstalledMods(true); }
//TODO: not enough info in ModEntry to match uninstall using passed in filename public void ProcessUninstallMod(List <string> modPaths, bool skipcleanup)// command-line uninstall using list of mod names { for (int i = 0; i < listInstalledMods.Items.Count; i++) { listInstalledMods.SetItemCheckState(i, CheckState.Unchecked); } var mods = manager.GetInstalledMods(); foreach (string modPath in modPaths) { ModEntry mod = mods.FirstOrDefault(entry => entry.Name == modPath); // select mod if (mod != null) { listInstalledMods.SetItemCheckState(mods.IndexOf(mod), CheckState.Checked); } } CheckedListBox.CheckedIndexCollection checkedModIndices = listInstalledMods.CheckedIndices; ProgressWindow.Show("Uninstalling Mod", "Uninstalling...", new Action((MethodInvoker) delegate { UninstallManager.UninstallMods(checkedModIndices, skipcleanup); }), log); }
// Test the constructors public void TestCheckedCollections() { CheckedListBox clb = new CheckedListBox(); CheckedListBox.CheckedIndexCollection indexes = clb.CheckedIndices; CheckedListBox.CheckedItemCollection items = clb.CheckedItems; string item0 = "item 0"; string item1 = "item 1"; string item2 = "item 2"; string item3 = "item 3"; AssertEquals("Count (1)", 0, indexes.Count); AssertEquals("Count (2)", 0, items.Count); clb.Items.Add(item0, false); AssertEquals("Count (3)", 0, indexes.Count); AssertEquals("Count (4)", 0, items.Count); clb.Items.Add(item1, true); AssertEquals("Count (5)", 1, indexes.Count); AssertEquals("Count (6)", 1, items.Count); clb.Items.Add(item2, true); AssertEquals("Count (7)", 2, indexes.Count); AssertEquals("Count (8)", 2, items.Count); clb.Items.Add(item3, false); AssertEquals("Count (9)", 2, indexes.Count); AssertEquals("Count (10)", 2, items.Count); AssertEquals("Indexer (1)", 1, indexes[0]); AssertEquals("Indexer (2)", 2, indexes[1]); AssertEquals("Indexer (3)", item1, items[0]); AssertEquals("Indexer (4)", item2, items[1]); AssertEquals("Index of (1)", -1, items.IndexOf(item0)); AssertEquals("Index of (2)", 0, items.IndexOf(item1)); AssertEquals("Index of (3)", 1, items.IndexOf(item2)); AssertEquals("Index of (4)", -1, items.IndexOf(item3)); }
private void Reload_Pokaz_Button_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection CLB_CIC1 = PokazStolbChB.CheckedIndices; for (int x = GridViewTable.Columns.Count; x > 0; x--) { if (!CLB_CIC1.Contains(x - 1)) { if (GridViewTable.Columns[x - 1].Visible) { GridViewTable.Columns[x - 1].Visible = false; } } else { if (!GridViewTable.Columns[x - 1].Visible) { GridViewTable.Columns[x - 1].Visible = true; } } } }
private void buttonUninstall_Click(object sender, EventArgs e) //sends checked indices to ModManager for uninstallation. { // Get the indices of all checked mods, and their names. CheckedListBox.CheckedIndexCollection checkedModIndices = listInstalledMods.CheckedIndices; CheckedListBox.CheckedItemCollection checkedModItems = listInstalledMods.CheckedItems; string markedModNames = ""; foreach (object mod in checkedModItems) { markedModNames += "\n" + mod.ToString(); } if (!(MessageBox.Show("The following mods will be uninstalled:\n" + markedModNames, "SnakeBite", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)) { return; } log.ClearPage(); SetVisiblePage(log); ProgressWindow.Show("Uninstalling Mod(s)", "Uninstalling, please wait...", new Action((MethodInvoker) delegate { UninstallManager.UninstallMods(checkedModIndices); }), log); RefreshInstalledMods(true); }
private void Refresh_Demonstration_Buttom_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection CLB_CIC1 = Otobr_1_Tabl.CheckedIndices; for (int x = DGV_Prin_Uvol_History.Columns.Count; x > 0; x--) { if (!CLB_CIC1.Contains(x - 1)) { if (DGV_Prin_Uvol_History.Columns[x - 1].Visible) { DGV_Prin_Uvol_History.Columns[x - 1].Visible = false; } } else { if (!DGV_Prin_Uvol_History.Columns[x - 1].Visible) { DGV_Prin_Uvol_History.Columns[x - 1].Visible = true; } } } CheckedListBox.CheckedIndexCollection CLB_CIC2 = Otobr_2_Tabl.CheckedIndices; for (int x = DGV_ZP_History.Columns.Count; x > 0; x--) { if (!CLB_CIC2.Contains(x - 1)) { if (DGV_ZP_History.Columns[x - 1].Visible) { DGV_ZP_History.Columns[x - 1].Visible = false; } } else { if (!DGV_ZP_History.Columns[x - 1].Visible) { DGV_ZP_History.Columns[x - 1].Visible = true; } } } }
private void buttonAddOrEditClick(object sender, EventArgs e) { fillServerData(); server.UseFavourites = radioUseFavourites.Checked; planKeys.Clear(); CheckedListBox.CheckedIndexCollection indices = checkedListBuilds.CheckedIndices; for (int i = 0; i < checkedListBuilds.Items.Count; i++) { if (indices.Contains(i)) { planKeys.Add(((BambooPlan)checkedListBuilds.Items[i]).Key); } } server.PlanKeys = planKeys; DialogResult = DialogResult.OK; Close(); }
private object ExtractStringFromCheckedListBox(CheckedListBox checkedListBox) { CheckedListBox.CheckedIndexCollection indices = checkedListBox.CheckedIndices; StringBuilder sb = new StringBuilder(); foreach (int index in indices) { sb.Append(m_names[index]); sb.Append("|"); } if (sb.Length > 0) { sb.Length--; // trim last "|" } else { sb.Append(NoFlags); } return(sb.ToString()); }
private void GetTblDatabackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _connector.UnLock(); this.refreshprogressBar.Value = 100; this.tableData.Rows.Clear(); this.tableData.Columns.Clear(); CheckedListBox.CheckedIndexCollection checkedIndices = this.tableStructure.CheckedIndices; this.tableData.ColumnCount = checkedIndices.Count; if (values.Count != 0) { for (int i = 0; i < headers.Length; i++) { tableData.Columns[i].HeaderText = headers[i]; } for (int i = 0; i < values.Count; i++) { this.tableData.Rows.Add(values[i]); } } trackBar.Enabled = true; }
//删除功能 private void toolStripButton2_Click(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection checkeds = hisListBox1.CheckedIndices; CheckedListBox.CheckedItemCollection checkedItems = hisListBox1.CheckedItems; if (checkeds.Count > 0) { for (int i = checkeds.Count - 1; i >= 0; i--) { hisJsonMap.Remove(hisStringList[checkeds[i]]); hisStringList.RemoveAt(checkeds[i]); string item = (string)checkedItems[i]; if (item == lastSelectHisItem) { Reset(); } hisListBox1.Items.RemoveAt(checkeds[i]); } } else { MessageBox.Show("请选择记录"); } }
public static bool UninstallMods(CheckedListBox.CheckedIndexCollection modIndices, bool skipCleanup = false) // Uninstalls mods based on their indices in the list { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Debug.LogLine("[Uninstall] Start", Debug.LogLevel.Basic); // initial cleanup ModManager.ClearBuildFiles(ZeroPath, OnePath, SnakeBiteSettings, SavePresetPath); ModManager.ClearSBGameDir(); ModManager.CleanupFolders(); // backup preset build if (Properties.Settings.Default.AutosaveRevertPreset == true) { PresetManager.SavePreset(SavePresetPath + build_ext); } else { Debug.LogLine("[Uninstall] Skipping RevertChanges.MGSVPreset Save", Debug.LogLevel.Basic); } GzsLib.LoadDictionaries(); File.Copy(SnakeBiteSettings, SnakeBiteSettings + build_ext, true); List <ModEntry> mods = SBBuildManager.GetInstalledMods(); List <ModEntry> selectedMods = new List <ModEntry>(); foreach (int index in modIndices) { ModEntry mod = mods[index]; selectedMods.Add(mod); } List <string> zeroFiles = new List <string>(); bool hasQarZero = ModManager.hasQarZeroFiles(selectedMods); if (hasQarZero) { // if necessary, extracts 00.dat and creates a list of filenames, which is pruned throughout the uninstall process and repacked at the end. zeroFiles = GzsLib.ExtractArchive <QarFile>(ZeroPath, "_working0"); zeroFiles.RemoveAll(file => file.EndsWith("_unknown")); } List <string> oneFiles = null; bool hasFtexs = ModManager.foundLooseFtexs(selectedMods); if (hasFtexs) { // if necessary, extracts 01.dat and creates a list of filenames similar to zeroFiles. only textures are pruned from the list. oneFiles = GzsLib.ExtractArchive <QarFile>(OnePath, "_working1"); oneFiles.RemoveAll(file => file.EndsWith("_unknown")); } //end of qar extraction GameData gameData = SBBuildManager.GetGameData(); ModManager.ValidateGameData(ref gameData, ref zeroFiles); Debug.LogLine("[Uninstall] Building gameFiles lists", Debug.LogLevel.Basic); var baseGameFiles = GzsLib.ReadBaseData(); try { ModManager.PrepGameDirFiles(); // begin uninstall UninstallMods(selectedMods, ref zeroFiles, ref oneFiles); if (hasQarZero) { zeroFiles.Sort(); GzsLib.WriteQarArchive(ZeroPath + build_ext, "_working0", zeroFiles, GzsLib.zeroFlags); } if (hasFtexs) { oneFiles.Sort(); GzsLib.WriteQarArchive(OnePath + build_ext, "_working1", oneFiles, GzsLib.oneFlags); } // end of qar rebuild // overwrite old mod data ModManager.PromoteGameDirFiles(); ModManager.PromoteBuildFiles(ZeroPath, OnePath, SnakeBiteSettings, SavePresetPath); if (!skipCleanup) { ModManager.CleanupFolders(); ModManager.ClearSBGameDir(); } Debug.LogLine("[Uninstall] Uninstall complete", Debug.LogLevel.Basic); stopwatch.Stop(); Debug.LogLine($"[Uninstall] Uninstall took {stopwatch.ElapsedMilliseconds} ms", Debug.LogLevel.Basic); return(true); } catch (Exception e) { Debug.LogLine("[Uninstall] Exception: " + e, Debug.LogLevel.Basic); stopwatch.Stop(); Debug.LogLine($"[Uninstall] Uninstall failed at {stopwatch.ElapsedMilliseconds} ms", Debug.LogLevel.Basic); MessageBox.Show("An error has occurred during the uninstallation process and SnakeBite could not uninstall the selected mod(s).\nException: " + e); // clean up failed files ModManager.ClearBuildFiles(ZeroPath, OnePath, SnakeBiteSettings, SavePresetPath); ModManager.CleanupFolders(); bool restoreRetry = false; do { try { ModManager.RestoreBackupGameDir(SBBuildManager); } catch (Exception f) { Debug.LogLine("[Uninstall] Exception: " + f, Debug.LogLevel.Basic); restoreRetry = DialogResult.Retry == MessageBox.Show("SnakeBite could not restore Game Directory mod files due to the following exception: {f} \nWould you like to retry?", "Exception Occurred", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); } } while (restoreRetry); ModManager.ClearSBGameDir(); return(false); } }//UninstallMod batch