mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-22 20:55:52 +12:00
Finish MPN00Bs
This commit is contained in:
parent
b439ad1511
commit
b83960d872
22 changed files with 720 additions and 155 deletions
|
@ -1,22 +1,28 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
using HISP.Server;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MPN00BS
|
||||
{
|
||||
public partial class LoadingWindow : Window
|
||||
{
|
||||
|
||||
|
||||
private void OnClientExit()
|
||||
{
|
||||
try
|
||||
{
|
||||
GameServer.ShutdownServer();
|
||||
}catch(Exception) { }
|
||||
}
|
||||
public void OnServerStarted()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
this.Hide();
|
||||
new SystemTrayIcon().Show();
|
||||
this.Close();
|
||||
ServerStarter.StartHorseIsleClient(OnClientExit, "127.0.0.1", 12321);
|
||||
});
|
||||
}
|
||||
public void OnNoUsersFound()
|
||||
|
@ -27,6 +33,15 @@ namespace MPN00BS
|
|||
});
|
||||
}
|
||||
|
||||
private void OnShutdown()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
ServerStarter.CloseHorseIsleClient();
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
|
||||
public void ProgressUpdate()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
|
@ -40,9 +55,13 @@ namespace MPN00BS
|
|||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
|
||||
ServerStarter.StartHttpServer();
|
||||
new Task( () => ServerStarter.StartHispServer(ProgressUpdate, OnNoUsersFound, OnServerStarted)).Start();
|
||||
new Task( () => ServerStarter.StartHispServer(ProgressUpdate, OnNoUsersFound, OnServerStarted, OnShutdown)).Start();
|
||||
}
|
||||
|
||||
private void OnServerClose(object sender, CancelEventArgs e)
|
||||
{
|
||||
GameServer.ShutdownServer();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue