public LoginWindow()
        {
            Instance = this;
            HomeWindow.GuiThreadId = Thread.CurrentThread.ManagedThreadId;

            InitializeComponent();

            App.LoggedOut();
        }
 private void windowLogin_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Instance = null;
     if (!IsLoggedIn)
     {
         App.IsShuttingDown = true;
     }
 }
        public void LogOut(bool showLoginWindow, bool isShutDown, bool isFromWindowClosingEvent)
        {
            if (UserDataManager.UserData == null)
                return;

            _allowClose = true;

            taskbarIcon.Visibility = System.Windows.Visibility.Collapsed;

            WindowTreeManager.ManualClosing();

            _paymentTab.LoggingOut();

            App.DebugBox = null;

            Hide();

            UserDataManager.UserData.LoggedOut();
            UserDataManager.UserData = null;

            if (showLoginWindow)
            {
                var lw = new LoginWindow();
                lw.Show();
            }

            if (isShutDown)
                App.IsShuttingDown = true;

            if (!isFromWindowClosingEvent)
                Close();

            if (isShutDown)
                WaitForThreadsToDie();
        }