private void btnConnect_Click(object sender, RoutedEventArgs e) { // Create the host and the ActiveX control WindowsFormsHost host = new WindowsFormsHost(); rdClient = new AxMsRdpClient8NotSafeForScripting(); // Add the ActiveX control to the host, and the host to the WPF panel host.Child = rdClient; tiGrid0.Children.Add(host); rdClient.Server = txtServer.Text.Trim(); rdClient.DesktopWidth = rdClient.Width = (int)TabControl1.Width; rdClient.DesktopHeight = rdClient.Height = (int)TabControl1.Height; //rdClient.AdvancedSettings8.ClearTextPassword = "******"; rdClient.AdvancedSettings8.EnableCredSspSupport = true; rpcConnect(); }
private void CheckRdp() { pnlCheck1.Visible = true; try { using (var rdpClient = new AxMsRdpClient8NotSafeForScripting()) { rdpClient.CreateControl(); while (!rdpClient.Created) { Thread.Sleep(10); System.Windows.Forms.Application.DoEvents(); } if (!(new Version(Convert.ToString(rdpClient.Version)) >= ProtocolRDP.Versions.RDC80)) { throw new Exception( $"Found RDC Client version {rdpClient.Version} but version {ProtocolRDP.Versions.RDC80} or higher is required."); } pbCheck1.Image = Resources.Good_Symbol; lblCheck1.ForeColor = Color.DarkOliveGreen; lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckSucceeded; txtCheck1.Text = string.Format(Language.strCcRDPOK, rdpClient.Version); Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "RDP installed", true); } } catch (Exception ex) { pbCheck1.Image = Resources.Bad_Symbol; lblCheck1.ForeColor = Color.Firebrick; lblCheck1.Text = "RDP (Remote Desktop) " + Language.strCcCheckFailed; txtCheck1.Text = Language.strCcRDPFailed; Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "RDP " + Language.strCcNotInstalledProperly, true); Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, ex.Message, true); } }
public ProtocolRDP() { Control = new AxMsRdpClient8NotSafeForScripting(); }