public async void Initialize() { await GetGlobalLock(); try { Util.LogHandlers.Add(AddLog); Server = new EncodeServer(App.Option.ServerPort, null, async() => { await RealCloseWindow(); }); await Server.Init(); RaisePropertyChanged(nameof(Server)); WindowCaption = "AmatsukazeServer" + Server.Version + "@" + Dns.GetHostName() + ":" + App.Option.ServerPort; // SleepCancel SleepCancelVM = new SleepCancelViewModel() { Model = Server }; var modelListener = new PropertyChangedEventListener(Server); modelListener.Add(() => Server.SleepCancel, (_, __) => ShowOrCloseSleepCancel()); CompositeDisposable.Add(modelListener); } catch (Exception e) { var message = new InformationMessage( "起動処理でエラーが発生しました\r\n" + e.Message + "\r\n" + e.StackTrace, "AmatsukazeServer", "Message"); await Messenger.RaiseAsync(message); await RealCloseWindow(); } if (App.Option.LaunchType == LaunchType.Debug) { var asm = Assembly.GetExecutingAssembly().GetName(); Process.Start(new ProcessStartInfo() { FileName = $"{AppContext.BaseDirectory}{asm.Name}.exe", Arguments = "--launch client", }); } }
public async void Initialize() { await GetGlobalLock(); try { Util.LogHandlers.Add(AddLog); Server = new EncodeServer(App.Option.ServerPort, null, async() => { await RealCloseWindow(); }); await Server.Init(); RaisePropertyChanged("Server"); WindowCaption = "AmatsukazeServer@" + Dns.GetHostName() + ":" + App.Option.ServerPort; } catch (Exception e) { var message = new InformationMessage( "起動処理でエラーが発生しました\r\n" + e.Message + "\r\n" + e.StackTrace, "AmatsukazeServer", "Message"); await Messenger.RaiseAsync(message); await RealCloseWindow(); } if (App.Option.LaunchType == LaunchType.Debug) { Process.Start(new ProcessStartInfo() { FileName = Assembly.GetEntryAssembly().Location, Arguments = "--launch client", }); } }