private void PostSite_Login(object sender, LoginEventArgs e) { Action a = () => { this.Cursor = Cursors.Arrow; if (this.leechClient.PostSite.User.IsLoggedIn) { this.txtPostLogin.IsEnabled = this.txtPostPasswrd.IsEnabled = this.txtBaseUrl.IsEnabled = this.lstForumType.IsEnabled = false; this.btnPostLogin.Content = "Logout"; this.imgPost.Source = new BitmapImage(new Uri("Images/LoggedIn.png", UriKind.Relative)); Cfg.Default.PostPassword = this.txtPostPasswrd.Password; } else { var msgResult = MessageBox.Show( Res.MsgLoginFailed, "Log-in Failed", MessageBoxButton.YesNoCancel, MessageBoxImage.Error, MessageBoxResult.No ); if (msgResult == MessageBoxResult.Yes) { string url = this.leechClient.PostSite.BaseUrl + this.leechClient.PostSite.LoginPath; string usr = this.leechClient.PostSite.User.Username; string pswd = this.leechClient.PostSite.User.Password; var win = new ManualLoginWindow(url, usr, pswd); win.Owner = this; var result = win.ShowDialog(); if (result != null && result != false) { this.leechClient.PostSite.User.IsLoggedIn = true; this.leechClient.PostSite.User.Cookies = win.CollectedCookies; this.txtPostLogin.IsEnabled = this.txtPostPasswrd.IsEnabled = this.txtBaseUrl.IsEnabled = this.lstForumType.IsEnabled = false; this.btnPostLogin.Content = "Logout"; this.imgPost.Source = new BitmapImage(new Uri("Images/LoggedIn.png", UriKind.Relative)); } } } if (this.leechClient.Reader.Type.User.IsLoggedIn && this.leechClient.PostSite.User.IsLoggedIn) { this.btnStartLeeching.IsEnabled = true; this.txtStatus.Text = "Ready..."; } else { this.btnStartLeeching.IsEnabled = false; this.txtStatus.Text = "Waiting for both Post and Leech login..."; } }; this.Dispatcher.Invoke(a, DispatcherPriority.Normal); }
public virtual void OnLogin(object sender, LoginEventArgs e) { if (this.Login != null) this.Login(sender, e); }