Fixed bots slider not updating correctly

This commit is contained in:
ruri
2020-02-22 01:58:49 +01:00
parent da7f0f3055
commit 6ebc8f7fd2
2 changed files with 13 additions and 2 deletions
@@ -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();
}
@@ -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