//private void CaptureScreen() //{ // try // { // using (Bitmap bmp = new Bitmap(this.Width, this.Height)) // { // this.DrawToBitmap(bmp, new Rectangle(0, 0, this.Width, this.Height)); // using (MemoryStream memory = new MemoryStream()) // { // bmp.Save(memory, ImageFormat.Jpeg); // captureBuf = memory.GetBuffer(); // } // } // } // catch (Exception ex) // { // Logger.AddError("Failed to make screenshot", ex); // captureBuf = null; // } //} private void checker_FormActionRequred(object sender, FormActionEventArgs e) { if (e.ActionType == FormActionEventArgs.FormActionType.SendEnter) { Thread.Sleep(2000); IntPtr inputWindowHandle = GetInputWindowHandle(); if (inputWindowHandle != IntPtr.Zero) { SetForegroundWindow(Handle); // sending ENTER PostMessage(inputWindowHandle, 0x0100, 0x0D, 0x001C0001); PostMessage(inputWindowHandle, 0x0101, 0x0D, 0x001C0001); } } else if (e.ActionType == FormActionEventArgs.FormActionType.CaptureScreen) { //CaptureScreen(); // Closing session so what Checker obj sends results this.rdpClient.Disconnect(); } }
private void RaiseFormActionRequired(FormActionEventArgs.FormActionType actionType) { var handler = FormActionRequred; if (handler != null) { handler(this, new FormActionEventArgs { ActionType = actionType }); } }