-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoader.axaml.cs
206 lines (166 loc) · 5.91 KB
/
Loader.axaml.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Animation.Easings;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform;
using zstio_tv.UI;
using zstio_tv.UI.Controls;
using zstio_tv.UI.Functions;
namespace zstio_tv;
public partial class Loader : Window
{
#region Initialization
public static Loader _Instance;
public Loader()
{
InitializeComponent();
_Instance = this;
}
#endregion
#region Animations
private async void LoadAnimations()
{
#region Animation:Background
Control _HandlerBackgroundStyling = this.FindControl<TextBlock>("HandlerBackgroundStyling");
if (_HandlerBackgroundStyling != null)
{
_HandlerBackgroundStyling.Opacity = 0.0f;
await Task.WhenAll(
AnimationManager.Animate(
_Delay: TimeSpan.FromSeconds(1),
_Duration: TimeSpan.FromSeconds(2.5),
_Property: PaddingProperty,
_FromValue: new Thickness(-275, 0, 0, 0),
_ToValue: new Thickness(-275, -250, 0, 0),
_Element: _HandlerBackgroundStyling,
_Easing: new CubicEaseOut()
),
AnimationManager.Animate(
_Delay: TimeSpan.FromSeconds(1),
_Duration: TimeSpan.FromSeconds(2.5),
_Property: OpacityProperty,
_FromValue: 0.0,
_ToValue: 1.0,
_Element: _HandlerBackgroundStyling,
_Easing: new CubicEaseOut()
)
);
_HandlerBackgroundStyling.Opacity = 1.0;
}
#endregion
#region Animation:Displays
Control _HandlerUIDisplays = this.FindControl<StackPanel>("HandlerUIDisplays");
#endregion
}
#endregion
#region Window
private void RenderScreens()
{
HandlerUIDisplays.Children.Clear();
foreach (Structures.ScreenInfo _CurrentScreen in Memory.Screens)
{
Border _ScreenBorder = new Border
{
Width = _CurrentScreen.Width / 8,
Height = _CurrentScreen.Height / 8,
MaxWidth = 300,
MaxHeight = 300,
CornerRadius = new CornerRadius(20),
Background = new SolidColorBrush(Color.Parse("#1C1C1C")),
BorderThickness = new Thickness(1),
Cursor = Cursor.Parse("Hand"),
Margin = new Thickness(5)
};
if (_CurrentScreen == Memory.SelectedScreen)
{
_ScreenBorder.BorderBrush = new SolidColorBrush(Colors.White);
}
else
{
_ScreenBorder.BorderBrush = new SolidColorBrush(Color.Parse("#6E6E6E"));
}
_ScreenBorder.PointerPressed += (sender, e) =>
{
Memory.SelectedScreen = _CurrentScreen;
RenderScreens();
};
_ScreenBorder.Effect = new DropShadowEffect
{
Color = Color.Parse("#40FFFFFF"),
BlurRadius = 10,
OffsetX = 0,
OffsetY = 0
};
TextBlock _ScreenTextBlock = new TextBlock
{
Text = _CurrentScreen.Index.ToString(),
FontSize = 24,
FontFamily = (FontFamily)Application.Current.Resources["SemiBold-Inter"],
Foreground = new SolidColorBrush(Color.Parse("#C1C1C1")),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
_ScreenBorder.Child = _ScreenTextBlock;
HandlerUIDisplays.Children.Add(_ScreenBorder);
}
}
private async void OnLoaded(object? sender, RoutedEventArgs e)
{
#region Animations
LoadAnimations();
#endregion
#region ScreenInfo:GET
IReadOnlyList<Screen> _AllScreens = Screens.All;
for (int i = 0; i < _AllScreens.Count; i++)
{
Screen _CurrentScreen = _AllScreens[i];
Memory.Screens.Add(new Structures.ScreenInfo
{
Index = i,
X = _CurrentScreen.Bounds.X,
Y = _CurrentScreen.Bounds.Y,
Width = _CurrentScreen.Bounds.Width,
Height = _CurrentScreen.Bounds.Height
});
}
#endregion
#region ScreenInfo:PUT
RenderScreens();
#endregion
}
private void WindowMove_Pressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{
this.BeginMoveDrag(e);
}
}
#endregion
#region ContinueButton
private void ContinueButton_Clicked(object? sender, RoutedEventArgs e)
{
if (Memory.SelectedScreen == null)
{
MessageBox.ShowAsync(this.GetType().Name, "Please select a Display.");
return;
}
Window Interface = new Interface();
Interface.Show();
this.Close();
}
private void ContinueButton_OnPointerEntered(object? sender, PointerEventArgs e)
{
ContinueButtonTextBlock.Foreground = new SolidColorBrush(Color.Parse("#E3E3E3"));
}
private void ContinueButton_OnPointerExited(object? sender, PointerEventArgs e)
{
ContinueButtonTextBlock.Foreground = new SolidColorBrush(Color.Parse("#282828"));
}
#endregion
}