feat(launcher): Campaign LA add Avalonia desktop shell
This commit is contained in:
parent
6c4cd2bbc6
commit
d0a9c65d85
31 changed files with 4831 additions and 16 deletions
41
src/AcDream.Launcher/MainWindow.axaml.cs
Normal file
41
src/AcDream.Launcher/MainWindow.axaml.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using AcDream.Launcher.ViewModels;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace AcDream.Launcher;
|
||||
|
||||
public sealed partial class MainWindow : Window
|
||||
{
|
||||
private readonly DispatcherTimer _statusTimer;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
_statusTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(250),
|
||||
};
|
||||
_statusTimer.Tick += OnStatusTimerTick;
|
||||
Opened += OnOpened;
|
||||
Closed += OnClosed;
|
||||
}
|
||||
|
||||
private void OnOpened(object? sender, EventArgs e) => _statusTimer.Start();
|
||||
|
||||
private void OnClosed(object? sender, EventArgs e)
|
||||
{
|
||||
_statusTimer.Stop();
|
||||
_statusTimer.Tick -= OnStatusTimerTick;
|
||||
Opened -= OnOpened;
|
||||
Closed -= OnClosed;
|
||||
}
|
||||
|
||||
private void OnStatusTimerTick(object? sender, EventArgs e)
|
||||
{
|
||||
if (DataContext is LauncherWindowViewModel viewModel)
|
||||
{
|
||||
viewModel.PollStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue