Exemple #1
0
        public void Disconnectedhandler()
        {
            Debug.NewMessage(this.ToString() + " " + " disconnected " + Thread.CurrentThread.Name);
            inviteWindow.Invoke(new MethodInvoker(delegate
            {
                inviteWindow.Show();

                playWindow.Close();
                MessageBox.Show("Network", "Disconnected");

                PlayerClock.Stop();
            }));
        }
Exemple #2
0
        public static void Exit()
        {
            Application.Current.MainWindow = null;
            if (LobbyClient != null)
            {
                LobbyClient.Stop();
            }

            try
            {
                if (DebugWindow != null)
                {
                    if (DebugWindow.IsLoaded)
                    {
                        DebugWindow.Close();
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
            }
            if (PlayWindow != null)
            {
                if (PlayWindow.IsLoaded)
                {
                    PlayWindow.Close();
                }
            }
            //Apparently this can be null sometimes?
            if (Application.Current != null)
            {
                Application.Current.Shutdown(0);
            }
        }
Exemple #3
0
        public static void Exit()
        {
            Application.Current.MainWindow = null;
            if (LobbyClient != null)
            {
                LobbyClient.Stop();
            }

            SaveLocation();
            try
            {
                if (DebugWindow != null)
                {
                    if (DebugWindow.IsLoaded)
                    {
                        DebugWindow.Close();
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
            }
            if (LauncherWindow != null)
            {
                if (LauncherWindow.IsLoaded)
                {
                    LauncherWindow.Close();
                }
            }
            if (MainWindow != null)
            {
                if (MainWindow.IsLoaded)
                {
                    MainWindow.Close();
                }
            }
            if (PlayWindow != null)
            {
                if (PlayWindow.IsLoaded)
                {
                    PlayWindow.Close();
                }
            }
            try
            {
                foreach (ChatWindow cw in ChatWindows.Where(cw => cw.IsLoaded))
                {
                    cw.CloseChatWindow();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
            //Apparently this can be null sometimes?
            if (Application.Current != null)
            {
                Application.Current.Shutdown(0);
            }
        }