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 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); }
public void ProcessUninstallMod(ModEntry mod) { ProgressWindow.Show("Uninstalling Mod", String.Format("Uninstalling {0}, please wait...", mod.Name), new Action((MethodInvoker) delegate { ModManager.UninstallMod(mod); })); }