Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            UserSyncer userSyncer = new UserSyncer();

            //TODO: check the network to make sure we've got the right credentials. If there's no network connection
            //check against a saved file that has hashed passwords or something.
            User tempUser = userSyncer.WebLogin(Username.Text, Password.Password);

            if (tempUser != null)
            {
                UserPrefs.OnLoad();
                MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);
                UserPrefs.SetUser(tempUser, true);
                mainWindow.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }