From 6ebc8f7fd28c03432598e8aac7af8315eb98d2ac Mon Sep 17 00:00:00 2001 From: ruri Date: Sat, 22 Feb 2020 01:58:49 +0100 Subject: [PATCH] Fixed bots slider not updating correctly --- OpenBullet/Views/Dialogs/DialogSelectConfig.xaml.cs | 7 +++++-- OpenBullet/Views/Main/Runner/Runner.xaml.cs | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/OpenBullet/Views/Dialogs/DialogSelectConfig.xaml.cs b/OpenBullet/Views/Dialogs/DialogSelectConfig.xaml.cs index a3f7393..b1a495f 100644 --- a/OpenBullet/Views/Dialogs/DialogSelectConfig.xaml.cs +++ b/OpenBullet/Views/Dialogs/DialogSelectConfig.xaml.cs @@ -34,8 +34,11 @@ namespace OpenBullet if (configsListView.SelectedItems.Count == 0) return; if(Caller.GetType() == typeof(Runner)) { - if (OB.OBSettings.General.LiveConfigUpdates) ((Runner)Caller).SetConfig(((ConfigViewModel)configsListView.SelectedItem).Config); - else ((Runner)Caller).SetConfig(IOManager.CloneConfig(((ConfigViewModel)configsListView.SelectedItem).Config)); + var config = ((ConfigViewModel)configsListView.SelectedItem).Config; + var runner = Caller as Runner; + + if (OB.OBSettings.General.LiveConfigUpdates) runner.SetConfig(config); + else runner.SetConfig(IOManager.CloneConfig(config)); } ((MainDialog)Parent).Close(); } diff --git a/OpenBullet/Views/Main/Runner/Runner.xaml.cs b/OpenBullet/Views/Main/Runner/Runner.xaml.cs index 9d74f4b..72b3581 100644 --- a/OpenBullet/Views/Main/Runner/Runner.xaml.cs +++ b/OpenBullet/Views/Main/Runner/Runner.xaml.cs @@ -240,6 +240,7 @@ namespace OpenBullet.Views.Main.Runner public void SetConfig(Config config) { vm.SetConfig(config, OB.OBSettings.General.RecommendedBots); + if (OB.OBSettings.General.RecommendedBots) UpdateBotsSlider(config.Settings.SuggestedBots); RetrieveRecord(); } @@ -248,6 +249,13 @@ namespace OpenBullet.Views.Main.Runner vm.SetWordlist(wordlist); RetrieveRecord(); } + + private void UpdateBotsSlider(int amount) + { + if (amount < botsSlider.Minimum) botsSlider.Value = botsSlider.Minimum; + else if (amount > botsSlider.Maximum) botsSlider.Value = botsSlider.Maximum; + else botsSlider.Value = amount; + } #endregion #region UI Elements