From 232de37576236470c8c71e18349e4d312a66e76a Mon Sep 17 00:00:00 2001
From: Babyhamsta <22938086+Babyhamsta@users.noreply.github.com>
Date: Fri, 27 Oct 2023 22:48:44 -0500
Subject: [PATCH] Add files via upload
Fixed an issue with setting confidence before selecting model crashes program, forgot to upload update changes so included UserController updates.
---
AimmyWPF/MainWindow.xaml.cs | 18 +++++++++++++++---
AimmyWPF/UserController/AInfoSection.xaml | 6 +++---
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/AimmyWPF/MainWindow.xaml.cs b/AimmyWPF/MainWindow.xaml.cs
index 473554eb..564650b9 100644
--- a/AimmyWPF/MainWindow.xaml.cs
+++ b/AimmyWPF/MainWindow.xaml.cs
@@ -630,9 +630,21 @@ void LoadSettingsMenu()
AIMinimumConfidence.Slider.TickFrequency = 1;
AIMinimumConfidence.Slider.ValueChanged += (s, x) =>
{
- double ConfVal = ((double)AIMinimumConfidence.Slider.Value);
- aimmySettings["AI_Min_Conf"] = ConfVal;
- _onnxModel.ConfidenceThreshold = (float)(ConfVal / 100.0f);
+ if (lastLoadedModel != "N/A")
+ {
+ double ConfVal = ((double)AIMinimumConfidence.Slider.Value);
+ aimmySettings["AI_Min_Conf"] = ConfVal;
+ _onnxModel.ConfidenceThreshold = (float)(ConfVal / 100.0f);
+ }
+ else
+ {
+ // Prevent double messageboxes..
+ if (AIMinimumConfidence.Slider.Value != aimmySettings["AI_Min_Conf"])
+ {
+ System.Windows.MessageBox.Show("Unable to set confidence, please select a model and try again.");
+ AIMinimumConfidence.Slider.Value = aimmySettings["AI_Min_Conf"];
+ }
+ }
};
SettingsScroller.Children.Add(AIMinimumConfidence);
diff --git a/AimmyWPF/UserController/AInfoSection.xaml b/AimmyWPF/UserController/AInfoSection.xaml
index ea3ce9ba..47d4e5b1 100644
--- a/AimmyWPF/UserController/AInfoSection.xaml
+++ b/AimmyWPF/UserController/AInfoSection.xaml
@@ -33,7 +33,7 @@
VerticalAlignment="Top" />