This repository was archived by the owner on Apr 12, 2026. It is now read-only.
forked from Stephanzion/YandexMusicBetaMod
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.axaml.cs
More file actions
55 lines (48 loc) · 1.52 KB
/
Main.axaml.cs
File metadata and controls
55 lines (48 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Interactivity;
namespace YandexMusicPatcherGui;
public partial class Main : Window
{
public Main()
{
InitializeComponent();
DataContext = new MainViewModel();
if (OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000))
{
TransparencyLevelHint = new[] { WindowTransparencyLevel.Mica, WindowTransparencyLevel.None };
}
else if (OperatingSystem.IsWindows())
{
TransparencyLevelHint = new[] { WindowTransparencyLevel.AcrylicBlur, WindowTransparencyLevel.None };
Background = new SolidColorBrush(Color.Parse("#CC000000"));
}
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
{
SystemDecorations = SystemDecorations.None;
TransparencyLevelHint = new[] { WindowTransparencyLevel.Blur, WindowTransparencyLevel.None };
Background = new SolidColorBrush(Color.Parse("#CC000000"));
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void Window_MouseDown(object sender, PointerPressedEventArgs e)
{
if (e.Source is Button)
{
return;
}
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{
BeginMoveDrag(e);
}
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
}