Beispiel #1
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (IMService.GetUsernameFromDb() == null)
     {
         Application.Current.Shutdown();
     }
 }
Beispiel #2
0
 public void Login()
 {
     if (IMService.GetUsernameFromDb() == null)
     {
         var signInWindow = new SignInWindow();
         signInWindow.RaiseSignInEvent += SignInButton_RaiseSignInEvent;
         signInWindow.Show();
     }
 }
Beispiel #3
0
        //Constructor

        public MainWindow()
        {
            var username = IMService.GetUsernameFromDb();

            if (username != null && IMService.GetUser(username) != null)
            {
                LoggedInUser = IMService.GetUser(username);
                InitProgram();
                var timer = new System.Threading.Timer(state => CheckForNewMessagesAndContacts(), null, DefaultMessageRefreshTime, Timeout.Infinite);
            }
            else
            {
                Hide();
                Login();
            }
        }