mirror of
https://github.com/islehorse/HISP.git
synced 2025-06-08 12:01:28 +12:00
Add Multiplatform HISP-NOOBS
This commit is contained in:
parent
b3df338715
commit
cdc136dcd4
24 changed files with 2140 additions and 668 deletions
49
HorseIsleServer/MPN00BS/LoadingWindow.axaml.cs
Normal file
49
HorseIsleServer/MPN00BS/LoadingWindow.axaml.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MPN00BS
|
||||
{
|
||||
public partial class LoadingWindow : Window
|
||||
{
|
||||
|
||||
private void OnClientExit()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
|
||||
public void ProgressUpdate()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
startupProgress.Value++;
|
||||
if (startupProgress.Value >= startupProgress.Maximum)
|
||||
{
|
||||
this.Hide();
|
||||
ServerStarter.StartHorseIsleClient(OnClientExit, "127.0.0.1", 12321);
|
||||
}
|
||||
});
|
||||
}
|
||||
public LoadingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
|
||||
ServerStarter.StartHttpServer();
|
||||
new Task( () => ServerStarter.StartHispServer(ProgressUpdate) ).Start();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
startupProgress = this.FindControl<ProgressBar>("startupProgress");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue