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();
            }
        }
예제 #2
0
        private void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            bool srvReady =
                System.Convert.ToBoolean(Tools.PortScan.Scanner.IsPortOpen(Info.Hostname, Info.Port.ToString()));

            ReconnectGroup.ServerReady = srvReady;

            if (ReconnectGroup.ReconnectWhenReady && srvReady)
            {
                tmrReconnect.Enabled = false;
                ReconnectGroup.DisposeReconnectGroup();
                ICA_Client.Connect();
            }
        }
        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();
            }
        }