private void CheckBox_Clicked(object sender, RoutedEventArgs e) { if (TempGuard.IsDoingWork(MainWindow.workType)) { return; } CheckBox cb = (CheckBox)(sender); if (cb.IsChecked == true) { if (!TempSettings.Instance.LoadedFirstMod) { Log.Output("Congrats! You selected your first mod! When you're ready, press the green \"Launch\" button" + " at the top of the program to launch and inject your mods!", OutputType.Both); TempSettings.Instance.LoadedFirstMod = true; TempSettings.Instance.SaveSettings(); } if (!Mods_UserControl.instance.SelectedMods_ListBox.Items.Contains(modName)) { Mods_UserControl.instance.SelectedMods_ListBox.Items.Add(modName); Mods_UserControl.instance.SelectedMods_ListBox.SelectedIndex = Mods_UserControl.instance.SelectedMods_ListBox.Items.Count - 1; Mods_UserControl.instance.modPaths.Add(modPath); SessionData.LoadedMods.Add(modPath); TempSettings.Instance.SaveSettings(); } } else { // Is not checked if (Mods_UserControl.instance.SelectedMods_ListBox.Items.Contains(modName)) { int selected = Mods_UserControl.instance.SelectedMods_ListBox.SelectedIndex; Mods_UserControl.instance.SelectedMods_ListBox.Items.Remove(modName); Mods_UserControl.instance.modPaths.Remove(modPath); SessionData.LoadedMods.Remove(modPath); TempSettings.Instance.SaveSettings(); if (selected == 0 && Mods_UserControl.instance.SelectedMods_ListBox.Items.Count >= 1) { Mods_UserControl.instance.SelectedMods_ListBox.SelectedIndex = selected; } else if (Mods_UserControl.instance.SelectedMods_ListBox.Items.Count > 1) { Mods_UserControl.instance.SelectedMods_ListBox.SelectedIndex = selected - 1; } } } //Mods_UserControl.instance.HandlePriorityButtons(); }
private void CheckBox_Clicked(object sender, RoutedEventArgs e) { if (TempGuard.IsDoingWork(MainWindow.workType)) { return; } bool isBtd6Running = SteamUtils.IsGameRunning(GameType.BTD6); if (isBtd6Running) { Logger.Log("You need to restart BTD6 for your changes to take place", OutputType.Both); } CheckBox cb = (CheckBox)(sender); if (cb.IsChecked == true) { if (!Settings.LoadedSettings.LoadedFirstMod) { Logger.Log("Congrats! You selected your first mod! When you're ready, press the green \"Launch\" button" + " at the top of the program to launch the game and play with your mods!", OutputType.Both); Settings.LoadedSettings.LoadedFirstMod = true; Settings.LoadedSettings.Save(); } if (!Mods_UserControl.instance.SelectedMods_ListBox.Items.Contains(modName)) { Mods_UserControl.instance.AddToSelectedModLB(modPath); if (modPath.EndsWith(Mods_UserControl.instance.disabledKey)) { modPath = modPath.Replace(Mods_UserControl.instance.disabledKey, ""); } } } else { // Is not checked if (Mods_UserControl.instance.SelectedMods_ListBox.Items.Contains(modName)) { Mods_UserControl.instance.RemoveFromSelectedLB(modPath); if (!modPath.EndsWith(Mods_UserControl.instance.disabledKey)) { modPath += Mods_UserControl.instance.disabledKey; } } } //Mods_UserControl.instance.HandlePriorityButtons(); }