diff --git a/Plane.FormationCreator/MainWindow.xaml b/Plane.FormationCreator/MainWindow.xaml index 694f6f0..a320ac8 100644 --- a/Plane.FormationCreator/MainWindow.xaml +++ b/Plane.FormationCreator/MainWindow.xaml @@ -20,6 +20,7 @@ Width="1920" Height="1080" Closing="Window_Closing" + Loaded="Window_Loaded" > diff --git a/Plane.FormationCreator/MainWindow.xaml.cs b/Plane.FormationCreator/MainWindow.xaml.cs index 4b86f2a..7771201 100644 --- a/Plane.FormationCreator/MainWindow.xaml.cs +++ b/Plane.FormationCreator/MainWindow.xaml.cs @@ -62,7 +62,12 @@ namespace Plane.FormationCreator } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { + bool waitnet = _copterManager.Logined; _copterManager.NetLogout(); + //等待网络退出 + if (waitnet) + System.Threading.Thread.Sleep(1000); + /* MessageBoxResult result = MessageBox.Show("Do you really want to exit?", "", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) @@ -71,6 +76,15 @@ namespace Plane.FormationCreator } */ } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + ServiceLocator.Current.GetInstance().LoginCommand.Execute(this); + } + + + + private void btnLogin_Click(object sender, RoutedEventArgs e) { var loginWindow = new ConnectWindow