diff --git a/LM-Kit-Maestro/App.xaml b/LM-Kit-Maestro/App.xaml
index 852524f..8b64dfd 100644
--- a/LM-Kit-Maestro/App.xaml
+++ b/LM-Kit-Maestro/App.xaml
@@ -13,30 +13,6 @@
- 1
- 0
-
-
-
-
-
-
-
diff --git a/LM-Kit-Maestro/Converters/EqualToZeroConverter.cs b/LM-Kit-Maestro/Converters/EqualToZeroConverter.cs
new file mode 100644
index 0000000..e40b52a
--- /dev/null
+++ b/LM-Kit-Maestro/Converters/EqualToZeroConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+
+namespace LMKitMaestro.Converters;
+
+internal sealed class EqualToZeroConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value != null && value is int integer)
+ {
+ return integer == 0;
+ }
+
+ return false;
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/LM-Kit-Maestro/Converters/FileNameConverter.cs b/LM-Kit-Maestro/Converters/FileNameConverter.cs
index 67fd42b..b941dac 100644
--- a/LM-Kit-Maestro/Converters/FileNameConverter.cs
+++ b/LM-Kit-Maestro/Converters/FileNameConverter.cs
@@ -2,7 +2,7 @@
namespace LMKitMaestro.Converters;
-class FileNameConverter : IValueConverter
+internal sealed class FileNameConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
diff --git a/LM-Kit-Maestro/Converters/FileSizeConverter.cs b/LM-Kit-Maestro/Converters/FileSizeConverter.cs
index e90f836..6d85231 100644
--- a/LM-Kit-Maestro/Converters/FileSizeConverter.cs
+++ b/LM-Kit-Maestro/Converters/FileSizeConverter.cs
@@ -1,41 +1,40 @@
using System.Globalization;
-namespace LMKitMaestro.Converters
+namespace LMKitMaestro.Converters;
+
+internal sealed class FileSizeConverter : IValueConverter
{
- class FileSizeConverter : IValueConverter
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ if (value != null)
{
- if (value != null)
- {
- Type type = value.GetType();
+ Type type = value.GetType();
- if (value is long bytes)
- {
- return FormatFileSize(bytes);
- }
+ if (value is long bytes)
+ {
+ return FormatFileSize(bytes);
}
-
- return string.Empty;
}
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
-
- private static string FormatFileSize(long bytes)
- {
- var unit = 1024;
+ return string.Empty;
+ }
- if (bytes < unit)
- {
- return $"{bytes} B";
- }
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
- var exp = (int)(Math.Log(bytes) / Math.Log(unit));
+ private static string FormatFileSize(long bytes)
+ {
+ var unit = 1024;
- return $"{bytes / Math.Pow(unit, exp):F2} {("KMGTPE")[exp - 1]}B";
+ if (bytes < unit)
+ {
+ return $"{bytes} B";
}
+
+ var exp = (int)(Math.Log(bytes) / Math.Log(unit));
+
+ return $"{bytes / Math.Pow(unit, exp):F2} {("KMGTPE")[exp - 1]}B";
}
}
diff --git a/LM-Kit-Maestro/Converters/GreaterThanZeroConverter.cs b/LM-Kit-Maestro/Converters/GreaterThanZeroConverter.cs
new file mode 100644
index 0000000..cef28bc
--- /dev/null
+++ b/LM-Kit-Maestro/Converters/GreaterThanZeroConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+
+namespace LMKitMaestro.Converters;
+
+internal sealed class GreaterThanZeroConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value != null && value is int integer)
+ {
+ return integer > 0;
+ }
+
+ return false;
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/LM-Kit-Maestro/UI/Pages/ModelsPage.xaml b/LM-Kit-Maestro/UI/Pages/ModelsPage.xaml
index 6ecb63f..fb8f3f1 100644
--- a/LM-Kit-Maestro/UI/Pages/ModelsPage.xaml
+++ b/LM-Kit-Maestro/UI/Pages/ModelsPage.xaml
@@ -343,7 +343,7 @@
TextColor="{StaticResource Error}"
Text="{Binding FileManager.UnsortedModels.Count, StringFormat='{}You have {0} unsorted model files'}"
Command="{Binding Source={x:Reference modelsPage}, Path=ShowUnsortedModelFilesPopupCommand}"
- IsVisible="{Binding FileManager.UnsortedModels.Count, Converter={StaticResource GreaterThanZeroConverter}}"/>
+ IsVisible="{Binding FileManager.UnsortedModels.Count, Converter={converters:GreaterThanZeroConverter}}"/>
@@ -353,7 +353,7 @@
-
+
diff --git a/LM-Kit-Maestro/UI/Popups/ModelSelectionPopup.xaml b/LM-Kit-Maestro/UI/Popups/ModelSelectionPopup.xaml
index ce87b4d..d7b2acf 100644
--- a/LM-Kit-Maestro/UI/Popups/ModelSelectionPopup.xaml
+++ b/LM-Kit-Maestro/UI/Popups/ModelSelectionPopup.xaml
@@ -40,7 +40,7 @@
RowDefinitions="*,*"
RowSpacing="20"
Margin="0, 0, 0, 8"
- IsVisible="{Binding ModelListViewModel.UserModels.Count, Converter={StaticResource EqualToZeroConverter}}">
+ IsVisible="{Binding ModelListViewModel.UserModels.Count, Converter={converters:EqualToZeroConverter}}">