private void LoginButton_Click(object sender, RoutedEventArgs e) { if (EmailTextbox.Text.Length == 0 || PasswordTextbox.Password.Length == 0) { errorLabel.Visibility = Visibility.Visible; DispatcherTimer t = new DispatcherTimer(); //Set the timer interval to the length of the animation. t.Interval = new TimeSpan(0, 0, 5); t.Tick += (EventHandler) delegate(object snd, EventArgs ea) { // The animation will be over now, collapse the label. errorLabel.Visibility = Visibility.Collapsed; // Get rid of the timer. ((DispatcherTimer)snd).Stop(); }; t.Start(); } else { OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\StarPix.accdb"); String sql = "UPDATE Credentials SET Username = "******"'" + EmailTextbox.Text + "'" + ", [Password] =" + "'" + PasswordTextbox.Password + "'" + ", isSaved=" + saveCredentials.IsChecked + " WHERE ID=1"; OleDbCommand command = new OleDbCommand(sql, connection); connection.Open(); command.ExecuteNonQuery(); this.Close(); string messgeBoxText; if (mainWindow._listbox.SelectedItems.Count == 1) { messgeBoxText = "Are you sure you want to upload 1 photo to Facebook?"; } else { messgeBoxText = "Are you sure you want to upload " + mainWindow._listbox.SelectedItems.Count + " photo(s) to Facebook?"; } string messageBoxCaption = "Upload Photo(s) to Facebook"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult rsltMessageBox = MessageBox.Show(messgeBoxText, messageBoxCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: FacebookUploadProgress facebookUploadProgress = new FacebookUploadProgress(mainWindow); facebookUploadProgress.ShowDialog(); break; } } }
private void LoginButton_Click(object sender, RoutedEventArgs e) { if (EmailTextbox.Text.Length == 0 || PasswordTextbox.Password.Length == 0) { errorLabel.Visibility = Visibility.Visible; DispatcherTimer t = new DispatcherTimer(); //Set the timer interval to the length of the animation. t.Interval = new TimeSpan(0, 0, 5); t.Tick += (EventHandler)delegate(object snd, EventArgs ea) { // The animation will be over now, collapse the label. errorLabel.Visibility = Visibility.Collapsed; // Get rid of the timer. ((DispatcherTimer)snd).Stop(); }; t.Start(); } else { OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\StarPix.accdb"); String sql = "UPDATE Credentials SET Username = "******"'" + EmailTextbox.Text + "'" + ", [Password] =" + "'" + PasswordTextbox.Password + "'" + ", isSaved=" + saveCredentials.IsChecked + " WHERE ID=1"; OleDbCommand command = new OleDbCommand(sql, connection); connection.Open(); command.ExecuteNonQuery(); this.Close(); string messgeBoxText; if (mainWindow._listbox.SelectedItems.Count == 1) { messgeBoxText = "Are you sure you want to upload 1 photo to Facebook?"; } else { messgeBoxText = "Are you sure you want to upload " + mainWindow._listbox.SelectedItems.Count + " photo(s) to Facebook?"; } string messageBoxCaption = "Upload Photo(s) to Facebook"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult rsltMessageBox = MessageBox.Show(messgeBoxText, messageBoxCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: FacebookUploadProgress facebookUploadProgress = new FacebookUploadProgress(mainWindow); facebookUploadProgress.ShowDialog(); break; } } }