private void RDPEvent_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            const int UI_ERR_NORMAL_DISCONNECT = 0xb08;
            if (e.discReason != UI_ERR_NORMAL_DISCONNECT)
            {
                string reason = RDP_Client.GetErrorDescription((uint)e.discReason, (uint)RDP_Client.ExtendedDisconnectReason);
                Event_Disconnected(this, e.discReason + Constants.vbCrLf + reason);
            }

            if (Settings.Default.ReconnectOnDisconnect)
            {
                ReconnectGroup = new ReconnectGroup();
                ReconnectGroup.Left = (Control.Width / 2) - (ReconnectGroup.Width / 2);
                ReconnectGroup.Top = (Control.Height / 2) - (ReconnectGroup.Height / 2);
                ReconnectGroup.Parent = Control;
                ReconnectGroup.Show();
                tmrReconnect.Enabled = true;
            }
            else
            {
                Close();
            }
        }
 private void AxOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (Disconnected != null)
     {
         Disconnected(this, new DisconnectEventArgs(e.discReason));
     }
 }
Example #3
0
 private void rdp_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (e.discReason == 1)
     {
         this.Close();
     }
 }
        void rdpClient_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
        {
            Status("Disconnected from " + this._sd.Server);

            btnConnect.Enabled    = true;
            btnDisconnect.Enabled = false;

            { // check connection status on output
                System.Diagnostics.Debug.WriteLine("OnDisconnected " + rdpClient.Connected);
            }

            if (Disconnected != null)
            {
                Disconnected(this, e, this._listIndex);
            }
        }
        private void ShowDisconnetMessageBox(IMsTscAxEvents_OnDisconnectedEvent e)
        {
            int reason = e.discReason;
            string error = RdpClientErrorMessages.ToDisconnectMessage(this.client, reason);

            if (!string.IsNullOrEmpty(error))
            {
                string message = String.Format("Error connecting to {0}\n\n{1}", this.client.Server, error);
                MessageBox.Show(this, message, Program.Info.TitleVersion, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private bool DecideToReconnect(IMsTscAxEvents_OnDisconnectedEvent e)
        {
            // 516 reason in case of reconnect expired
            // 2308 connection lost
            // 2 - regular logof also in case of forced reboot or shutdown
            if (e.discReason != 2308 && e.discReason != 2)
                return false;

            return settings.AskToReconnect;
        }
 private void client_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (DecideToReconnect(e))
     {
         this.TryReconnect();
     }
     else
     {
         this.ShowDisconnetMessageBox(e);
         this.FireDisconnected();
     }
 }
        void axMsTscAx_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            AxMsRdpClient2 client = (AxMsRdpClient2)sender;

            string error = Functions.GetErrorMessage(e.discReason);
            if(error != null)
            {
            //                MessageBox.Show(this, String.Format("Error connecting to {0} ({1})", client.Server, error), "Terminals " + Program.TerminalsVersion.ToString(),MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            TabControlItem selectedTabPage = (TabControlItem)(client.Parent);
            bool wasSelected = selectedTabPage.Selected;
            ParentForm.tcTerminals.RemoveTab(selectedTabPage);
            ParentForm.tcTerminals_TabControlItemClosed(null, EventArgs.Empty);
            if(wasSelected)
                NativeApi.PostMessage(new HandleRef(this, this.Handle), MainForm.WM_LEAVING_FULLSCREEN, IntPtr.Zero, IntPtr.Zero);
            ParentForm.UpdateControls();

            if(OnDisconnected != null) OnDisconnected(this);
        }
Example #9
0
        private static bool DecideToReconnect(IMsTscAxEvents_OnDisconnectedEvent e)
        {
            // 516 reason in case of reconnect expired
            // 2308 connection lost
            // 2 - regular logoff also in case of forced reboot or shutdown
            if (e.discReason != 2308 && e.discReason != 2)
                return false;

            return Terminals.Configuration.Files.Main.Settings.Settings.AskToReconnect;
        }
Example #10
0
 private void rdpc_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     ((cRemote.cRemote) base.FindForm()).DisconnectConnection(base.TabIndex);
 }
Example #11
0
        private void client_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            if (timer.Enabled)
                timer.Stop();

            if (e.discReason != 1 && e.discReason != 2 && e.discReason != 3)
            {
                //conection failure
                failCode = e.discReason;
                string failDescription = client.GetErrorDescription((uint)e.discReason, (uint)client.ExtendedDisconnectReason);
                failInfo.AppendFormat("Connection failed: {0}", string.IsNullOrEmpty(failDescription) ? "No description" : failDescription);
            }

            status = CheckerStatusEnum.done;
            SendCheckResult();
        }
Example #12
0
        void rdcWindow_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            if (e.discReason > 3)
                MessageBox.Show("Unable to establish a connection to the remote system.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            Close();
        }