internal static string ToDisconnectMessage(AxMsRdpClient6NotSafeForScripting client, int reason)
        {
            switch (reason)
            {
                case 1:
                case 2:
                case 3:
                    // These are normal disconnects and not considered errors.
                    return String.Empty;

                default:
                    return client.GetErrorDescription((uint)reason, (uint)client.ExtendedDisconnectReason);
            }
        }
 private bool InitializeClientControl()
 {
     try
     {
         this.client = new AxMsRdpClient6NotSafeForScripting();
     }
     catch (Exception exception)
     {
         string message = "Please update your RDP client to at least version 6.";
         Logging.Info(message, exception);
         MessageBox.Show(message);
         return false;
     }
     return true;
 }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.connectionStateDetector.Dispose();
                this.client.Dispose();
                this.client = null;
            }

            base.Dispose(disposing);
        }