void btnAnimeBytesTest_Click(object sender, EventArgs e) { try { SaveSettings(); if (string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesUsername)) { MessageBox.Show("Please enter a username first"); txtAnimeBytesUsername.Focus(); return; } if (string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesPassword)) { MessageBox.Show("Please enter a password first"); txtAnimeBytesPassword.Focus(); return; } this.Cursor = Cursors.WaitCursor; TorrentsAnimeBytes AnimeBytes = new TorrentsAnimeBytes(); BaseConfig.Settings.AnimeBytesCookieHeader = AnimeBytes.Login(BaseConfig.Settings.AnimeBytesUsername, BaseConfig.Settings.AnimeBytesPassword); if (!string.IsNullOrEmpty(BaseConfig.Settings.AnimeBytesCookieHeader)) { this.Cursor = Cursors.Arrow; MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.Cursor = Cursors.Arrow; MessageBox.Show("Connected FAILED", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAnimeBytesUsername.Focus(); return; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } }
void btnTest_Click(object sender, RoutedEventArgs e) { UserSettingsVM.Instance.AnimeBytesCookieHeader = ""; if (string.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show("Please enter Anime Byt.es login details", "Error", MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } UserSettingsVM.Instance.AnimeBytesUsername = txtUsername.Text.Trim(); Window parentWindow = Window.GetWindow(this); parentWindow.Cursor = Cursors.Wait; this.IsEnabled = false; TorrentsAnimeBytes AnimeBytes = new TorrentsAnimeBytes(); UserSettingsVM.Instance.AnimeBytesCookieHeader = AnimeBytes.Login(UserSettingsVM.Instance.AnimeBytesUsername, UserSettingsVM.Instance.AnimeBytesPassword); parentWindow.Cursor = Cursors.Arrow; this.IsEnabled = true; if (!string.IsNullOrEmpty(UserSettingsVM.Instance.AnimeBytesCookieHeader)) { 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) { VM_UserSettings.Instance.AnimeBytesCookieHeader = ""; if (string.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show(Shoko.Commons.Properties.Resources.Downloads_AnimeBytesDetails, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } VM_UserSettings.Instance.AnimeBytesUsername = txtUsername.Text.Trim(); Window parentWindow = Window.GetWindow(this); parentWindow.Cursor = Cursors.Wait; IsEnabled = false; TorrentsAnimeBytes AnimeBytes = new TorrentsAnimeBytes(); VM_UserSettings.Instance.AnimeBytesCookieHeader = AnimeBytes.Login(VM_UserSettings.Instance.AnimeBytesUsername, VM_UserSettings.Instance.AnimeBytesPassword); parentWindow.Cursor = Cursors.Arrow; IsEnabled = true; if (!string.IsNullOrEmpty(VM_UserSettings.Instance.AnimeBytesCookieHeader)) { MessageBox.Show(Shoko.Commons.Properties.Resources.Downloads_Connected, Shoko.Commons.Properties.Resources.Success, MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(Shoko.Commons.Properties.Resources.Downloads_Failed, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtUsername.Focus(); return; } }