public bool Login(string UserName, string Password, string Client, string Language) { BeforeLogin?.Invoke(Session, new EventArgs()); Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-BNAME").Text = UserName; Session.FindById <GuiTextField>("wnd[0]/usr/pwdRSYST-BCODE").Text = Password; Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-MANDT").Text = Client; Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-LANGU").Text = Language; var window = Session.FindById <GuiFrameWindow>("wnd[0]"); window.SendVKey(0); GuiStatusbar status = Session.FindById <GuiStatusbar>("wnd[0]/sbar"); if (status != null && status.MessageType.ToLower() == "e") { Connection.CloseSession(Session.Id); FailLogin?.Invoke(Session, new EventArgs()); return(false); } AfterLogin?.Invoke(Session, new EventArgs()); GuiRadioButton rb_Button = Session.FindById <GuiRadioButton>("wnd[1]/usr/radMULTI_LOGON_OPT2"); if (rb_Button != null) { rb_Button.Select(); window.SendVKey(0); } return(true); }
private void WebBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e) { if (webBrowser.HasErorr) { ClientUri = null; ShowFailed(webBrowser.ErrorDescription, true); } else { if (ClientUri != null) { webBrowser.Stop(); AfterLoginEventArgs eventArgs = new AfterLoginEventArgs(ClientUri, CookieUtil.InternetGetCookieEx(ClientUri), Email); AfterLogin?.Invoke(eventArgs); if (eventArgs.Sucess) { DialogResult = DialogResult.OK; Close(); } else { ShowFailed(eventArgs.Error); } } } }