void btnTest_Click(object sender, RoutedEventArgs e) { UserSettingsVM.Instance.BakaBTCookieHeader = ""; if (string.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show("Please enter BakaBT login details", "Error", MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } UserSettingsVM.Instance.BakaBTUsername = txtUsername.Text.Trim(); Window parentWindow = Window.GetWindow(this); parentWindow.Cursor = Cursors.Wait; this.IsEnabled = false; TorrentsBakaBT bakaBT = new TorrentsBakaBT(); UserSettingsVM.Instance.BakaBTCookieHeader = bakaBT.Login(UserSettingsVM.Instance.BakaBTUsername, UserSettingsVM.Instance.BakaBTPassword); parentWindow.Cursor = Cursors.Arrow; this.IsEnabled = true; if (!string.IsNullOrEmpty(UserSettingsVM.Instance.BakaBTCookieHeader)) MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButton.OK, MessageBoxImage.Information); else { MessageBox.Show("Failed! See log for more details if needed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } }
void btnTest_Click(object sender, RoutedEventArgs e) { UserSettingsVM.Instance.BakaBTCookieHeader = ""; if (string.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show(Properties.Resources.Downloads_BakaBTDetails, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } UserSettingsVM.Instance.BakaBTUsername = txtUsername.Text.Trim(); Window parentWindow = Window.GetWindow(this); parentWindow.Cursor = Cursors.Wait; this.IsEnabled = false; TorrentsBakaBT bakaBT = new TorrentsBakaBT(); UserSettingsVM.Instance.BakaBTCookieHeader = bakaBT.Login(UserSettingsVM.Instance.BakaBTUsername, UserSettingsVM.Instance.BakaBTPassword); parentWindow.Cursor = Cursors.Arrow; this.IsEnabled = true; if (!string.IsNullOrEmpty(UserSettingsVM.Instance.BakaBTCookieHeader)) MessageBox.Show(Properties.Resources.Downloads_Connected, Properties.Resources.Success, MessageBoxButton.OK, MessageBoxImage.Information); else { MessageBox.Show(Properties.Resources.Downloads_Failed, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } }