diff --git a/MusicX/App.xaml.cs b/MusicX/App.xaml.cs
index fc94bec6..5c5aedd5 100644
--- a/MusicX/App.xaml.cs
+++ b/MusicX/App.xaml.cs
@@ -1,4 +1,5 @@
-using System.Threading;
+using System;
+using System.Threading;
using System.Windows;
using MusicX.Patches;
using MusicX.Services;
@@ -35,6 +36,9 @@ protected async override void OnStartup(StartupEventArgs e)
SetupAnalytics();
+ if (ShowUnsupportedOsMessage())
+ return;
+
ItemContainerGeneratorIndexHook.Apply();
var window = new StartingWindow(e.Args);
@@ -43,6 +47,33 @@ protected async override void OnStartup(StartupEventArgs e)
await SingleAppService.Instance.StartArgsListener();
}
+ private static bool ShowUnsupportedOsMessage()
+ {
+ if (OperatingSystem.IsWindowsVersionAtLeast(StaticService.MinimumOsVersion.Major,
+ StaticService.MinimumOsVersion.Minor,
+ StaticService.MinimumOsVersion.Build,
+ StaticService.MinimumOsVersion.Revision))
+ return false;
+
+ if (OperatingSystem.IsWindowsVersionAtLeast(10))
+ {
+ var window = new UnsupportedOsVersionWindow();
+
+ window.Show();
+ return true;
+ }
+
+ MessageBox.Show(
+ $"""
+ Установите последнюю версию Windows 10 или выше
+ Минимальная версия: {StaticService.MinimumOsVersion}
+ У вас установлена версия {StaticService.CurrentOsVersion}
+ """,
+ "Неподдерживаемая версия Windows", MessageBoxButton.OK, MessageBoxImage.Error);
+
+ return true;
+ }
+
private static void SetupAnalytics()
{
var sentryOptions = new SentryNLogOptions
diff --git a/MusicX/Controls/WindowsVersionBlock.xaml b/MusicX/Controls/WindowsVersionBlock.xaml
new file mode 100644
index 00000000..7174c01b
--- /dev/null
+++ b/MusicX/Controls/WindowsVersionBlock.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+ .
+
+ .
+
+ .
+
+
+
+
diff --git a/MusicX/Controls/WindowsVersionBlock.xaml.cs b/MusicX/Controls/WindowsVersionBlock.xaml.cs
new file mode 100644
index 00000000..9825f072
--- /dev/null
+++ b/MusicX/Controls/WindowsVersionBlock.xaml.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace MusicX.Controls;
+
+public partial class WindowsVersionBlock : UserControl
+{
+ public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
+ nameof(Version), typeof(Version), typeof(WindowsVersionBlock), new PropertyMetadata(default(Version)));
+
+ public Version Version
+ {
+ get => (Version)GetValue(VersionProperty);
+ set => SetValue(VersionProperty, value);
+ }
+
+ public WindowsVersionBlock()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/MusicX/Services/StaticService.cs b/MusicX/Services/StaticService.cs
index dae6c10b..c21d49bc 100644
--- a/MusicX/Services/StaticService.cs
+++ b/MusicX/Services/StaticService.cs
@@ -11,6 +11,9 @@ public static class StaticService
public static string BuildDate { get; } =
typeof(StaticService).Assembly.GetCustomAttribute()?.Date.ToLocalTime()
.ToString("d MMMM yyyy", CultureInfo.GetCultureInfo("ru-RU")) ?? "23 сентября 2023";
+
+ public static Version MinimumOsVersion { get; } = new(10, 0, 19041, 0);
+ public static Version CurrentOsVersion { get; } = Environment.OSVersion.Version;
}
[AttributeUsage(AttributeTargets.Assembly)]
diff --git a/MusicX/Views/UnsupportedOsVersionWindow.xaml b/MusicX/Views/UnsupportedOsVersionWindow.xaml
new file mode 100644
index 00000000..637ad791
--- /dev/null
+++ b/MusicX/Views/UnsupportedOsVersionWindow.xaml
@@ -0,0 +1,36 @@
+
+
+ Упс! Кажется ваша система слишком устарела
+ Пожалуйста обновите Windows.
+
+
+
+
+
+
+ Минимальная версия системы
+
+
+
+
+
+
+
+
+ У вас сейчас установлена версия
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MusicX/Views/UnsupportedOsVersionWindow.xaml.cs b/MusicX/Views/UnsupportedOsVersionWindow.xaml.cs
new file mode 100644
index 00000000..c865bc9b
--- /dev/null
+++ b/MusicX/Views/UnsupportedOsVersionWindow.xaml.cs
@@ -0,0 +1,9 @@
+namespace MusicX.Views;
+
+public partial class UnsupportedOsVersionWindow
+{
+ public UnsupportedOsVersionWindow()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file