コード例 #1
0
        private void RdpcOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            _isDisconned = true;
            ResizeEndStopFireDelegate();
            if (this._onResizeEnd != null)
            {
                this._onResizeEnd -= ReSizeRdp;
            }

            const int UI_ERR_NORMAL_DISCONNECT = 0xb08;
            string    reason = _rdp.GetErrorDescription((uint)e.discReason, (uint)_rdp.ExtendedDisconnectReason);

            if (e.discReason != UI_ERR_NORMAL_DISCONNECT)
            {
                SimpleLogHelper.Warning($"RDP({_rdpServer.DispName}) exit with error code {e.discReason}({reason})");
            }
            if (e.discReason != UI_ERR_NORMAL_DISCONNECT &&
                e.discReason != (int)EDiscReason.exDiscReasonAPIInitiatedDisconnect &&
                e.discReason != (int)EDiscReason.exDiscReasonAPIInitiatedLogoff &&
                reason != "")
            {
                string disconnectedText = $"{_rdpServer.DispName}({_rdpServer.Address}) : {reason}";
                var    t = new Task(() =>
                {
                    System.Windows.MessageBox.Show(disconnectedText, SystemConfig.Instance.Language.GetText("messagebox_title_info"), MessageBoxButton.OK, MessageBoxImage.Warning);
                });
                t.Start();
            }
            base.OnClosed?.Invoke(base.ConnectionId);
        }
コード例 #2
0
        private async void rdpClient_OnDisconnected(
            object sender,
            IMsTscAxEvents_OnDisconnectedEvent args)
        {
            var e = new RdpDisconnectedException(
                args.discReason,
                this.rdpClient.GetErrorDescription((uint)args.discReason, 0));

            using (ApplicationTraceSources.Default.TraceMethod().WithParameters(e.Message))
            {
                LeaveFullScreen();

                if (!this.connecting && e.IsTimeout)
                {
                    // An already-established connection timed out, this is common when
                    // connecting to Windows 10 VMs.
                    //
                    // NB. The same error code can occur during the initial connection,
                    // but then it should be treated as an error.

                    this.reconnectPanel.Visible = true;
                }
                else if (e.IsIgnorable)
                {
                    Close();
                }
                else
                {
                    await ShowErrorAndClose("Disconnected", e)
                    .ConfigureAwait(true);;
                }
            }
        }
コード例 #3
0
 void internalMsClient_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (Disconnected != null)
     {
         Disconnected(this, new DisconnectedEventArgs(e.discReason));
     }
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
ファイル: RdpConnection.cs プロジェクト: nerodark/Suncat
 private void AxOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (Disconnected != null)
     {
         Disconnected(this, new DisconnectEventArgs(e.discReason));
     }
 }
コード例 #6
0
        private void RdpClient_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            Status("Disconnected from " + CurrentServer.Server);

            ChangeState(RdpState.Disconnected, e.discReason);

            System.Diagnostics.Debug.WriteLine("OnDisconnected " + rdpClient.Connected);
        }
コード例 #7
0
        private void OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            isConnected = false;
            ExtendedDisconnectReasonCode extendedDisconnectReason = rdp.ExtendedDisconnectReason;
            string errorDescription = rdp.GetErrorDescription((uint)e.discReason, (uint)extendedDisconnectReason);

            Log.Error($"ChildSession Disconnected: {errorDescription}, Reason: {e.discReason}, ExtendedReason {extendedDisconnectReason}");
            Close();
        }
コード例 #8
0
ファイル: FormMain.cs プロジェクト: weikety/EasyRemote
        // 远程桌面-连接断开
        private void axMsRdpc_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            var    _axMsRdp         = sender as AxMsRdpClient7NotSafeForScripting;
            string disconnectedText = string.Format("远程桌面 {0} 连接已断开!", _axMsRdp.Server);

            _axMsRdp.DisconnectedText = disconnectedText;
            _axMsRdp.FindForm().Close();
            Global.WinMessage(disconnectedText, "远程连接");
        }
コード例 #9
0
ファイル: DesktopLogon.cs プロジェクト: gitmirrors2/xpra
 private static void OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Console.WriteLine("OnDisconnected: {0:D}", e.discReason);
     if (ErrorCode == -1)
     {
         ErrorCode = e.discReason;
     }
     //Environment.Exit(ErrorCode);
 }
コード例 #10
0
ファイル: RDPConnection.cs プロジェクト: zivalin/Terminals
        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, "Terminals", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #11
0
 private void Mstsc_ResizeReconnect(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Invoke((Action)(() =>
     {
         Controls.Remove(mstsc);
         mstsc.Dispose();
         mstsc = new AxMsRdpClientNotSafeForScripting();
         Controls.Add(mstsc);
         Connect();
     }));
 }
コード例 #12
0
ファイル: RDPConnection.cs プロジェクト: zivalin/Terminals
        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(this.Settings.AskToReconnect);
        }
コード例 #13
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);
        }
コード例 #14
0
        private void RdpConnectionOnOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            DisconnectCode = e.discReason;
            var dire = Enum.GetName(typeof(DisconnectReasons), (uint)DisconnectCode);

            Console.WriteLine("[+] Connection closed     :  {0}", target);
            if (e.discReason != 1)
            {
                Console.WriteLine("[-] Disconnection Reason  :  {0} - {1}", DisconnectCode, dire);
            }
            Environment.Exit(0);
        }
コード例 #15
0
        // on disconnect event handler
        private void RdpConnectionOnOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            CreateWmiProcess wmi = new CreateWmiProcess();

            wmi.Username     = UserName;
            wmi.Domain       = Domain;
            wmi.Password     = Password;
            wmi.WmiTimeout   = "60";
            wmi.ComputerName = Server;
            wmi.InvokeCommand("cmd /c gpupdate /force /wait:0");
            Environment.Exit(0);
        }
コード例 #16
0
ファイル: RDPConnection.cs プロジェクト: zivalin/Terminals
 private void client_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     if (this.DecideToReconnect(e))
     {
         this.TryReconnect();
     }
     else
     {
         this.ShowDisconnetMessageBox(e);
         this.FireDisconnected();
     }
 }
コード例 #17
0
        // [Event] 원격연결 OnDisconnected
        private void rdp_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            var    rdp   = sender as AxMsRdpClient9NotSafeForScripting;
            var    test  = rdp.GetErrorDescription(0, 0);
            var    test2 = rdp.ExtendedDisconnectReason;
            string msg   = $"원격 데스크탑 {rdp.Server} 연결이 끊겼습니다!";

            rdp.DisconnectedText = msg;
            var form = rdp.FindForm();

            //form.Close();
            //form.Dispose();
            //rdp.Dispose();
            Status = msg;
        }
コード例 #18
0
        private void RdpClient_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            var rdpClient = sender as AxMsRdpClient7;

            if (e.discReason != 0 && e.discReason != 1 && e.discReason != 2 && e.discReason != 3)
            {
                if (e.discReason != 2825)
                {
                    MessageBox.Show(rdpClient.GetErrorDescription((uint)e.discReason, (uint)rdpClient.ExtendedDisconnectReason));
                }
            }
            rdpClient?.Parent.Dispose();
            rdpClient.Dispose();
            CheckAllTabPageState();
        }
コード例 #19
0
        /// <summary>
        /// Handler method that's called when an established connection is broken.  Displays an error message to the user if this was not the result of a
        /// logoff process.
        /// </summary>
        /// <param name="sender">Object from which this event originated, <see cref="_rdpWindow"/> in this case.</param>
        /// <param name="e">Arguments associated with this event.</param>
        private void _rdpWindow_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            if (e.discReason > 3)
            {
                OnConnectionLost(
                    sender, new ErrorEventArgs(new Exception(_rdpWindow.GetErrorDescription((uint)e.discReason, (uint)_rdpWindow.ExtendedDisconnectReason))));
            }

            else
            {
                OnLoggedOff(sender, null);
            }

            _rdpWindowSizeSet = false;
        }
コード例 #20
0
        private void AxMsTscAxNotSafeForScripting1_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            try
            {
                label5.Text    = "断开连接";
                this.isConnext = false;

                button1.Enabled = true;
                button1.Text    = "连接";
            }
            catch
            {
                throw new NotImplementedException();
            }
        }
コード例 #21
0
        private void RDC_Event_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            AxMsRdpClient7NotSafeForScripting rdc = sender as AxMsRdpClient7NotSafeForScripting;

            if (rdp2formMap.ContainsKey(rdc.Name))
            {
                Form form = rdp2formMap[rdc.Name];
                if (form2rdpMap.ContainsKey(form.Name))
                {
                    form2rdpMap.Remove(form.Name);
                }
                form.Close();
                rdp2formMap.Remove(rdc.Name);
                Trace.TraceInformation("rdm session closed.");
            }
        }
コード例 #22
0
        private async void rdpClient_OnDisconnected(
            object sender,
            IMsTscAxEvents_OnDisconnectedEvent args)
        {
            var e = new RdpDisconnectedException(
                args.discReason,
                this.rdpClient.GetErrorDescription((uint)args.discReason, 0));

            using (TraceSources.IapDesktop.TraceMethod().WithParameters(e.Message))
            {
                if (e.IsIgnorable)
                {
                    Close();
                }
                else
                {
                    await ShowErrorAndClose("Disconnected", e);
                }
            }
        }
コード例 #23
0
        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();
            }
        }
コード例 #24
0
        private void axMsRdpc_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            AxMsRdpClient7NotSafeForScripting axMsRdpc = (AxMsRdpClient7NotSafeForScripting)sender;

            axMsRdpc.DisconnectedText = "连接失败,连接已断开!请关闭重试!";
        }
コード例 #25
0
 private void Mstsc_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Connected = false;
 }
コード例 #26
0
 private void RdpConnectionOnOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Environment.Exit(0);
 }
コード例 #27
0
        /// <summary>
        /// 远程桌面断开连接
        /// </summary>
        private void MyRdp_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
        {
            if (e.discReason == 0x001)
            {
                MyRdp_OnRequestLeaveFullScreen(null, null);
                Closed?.Invoke();
                return;
            }
            string discReason = $"未知错误,错误代码{e.discReason}。";

            if (e.discReason == 0x904)
            {
                discReason = $"网络连接被关闭,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x3)
            {
                discReason = $"远程桌面服务会话已结束。\n\n另一用户已连接到此远程计算机,因此你的连接已丢失,请尝试再次连接。";
            }
            else if (e.discReason == 0x108)
            {
                discReason = $"连接超时,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x104)
            {
                discReason = $"DNS名称查找失败,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x508)
            {
                discReason = $"DNS查找失败,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x208)
            {
                discReason = $"主机未找到错误,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x408)
            {
                discReason = $"内部错误,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x906 || e.discReason == 0xA06)
            {
                discReason = $"内部安全错误,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x804)
            {
                discReason = $"指定了错误的IP地址,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x308)
            {
                discReason = $"指定的IP地址无效,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x106 || e.discReason == 0x206 || e.discReason == 0x306)
            {
                discReason = $"内存不足,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x2)
            {
                discReason = $"用户远程断开连接,错误代码{e.discReason}。";
            }
            else if (e.discReason == 0x204)
            {
                discReason = $"网络连接失败,错误代码{e.discReason}。";
            }
            OnFatalError?.Invoke("断开连接", discReason);
        }
コード例 #28
0
 private void Rdp_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Finished();
 }
コード例 #29
0
ファイル: AxMSTSCLib.cs プロジェクト: huizh/xenadmin
 internal void RaiseOnOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e) {
     if ((this.OnDisconnected != null)) {
         this.OnDisconnected(sender, e);
     }
 }
コード例 #30
0
ファイル: Client.cs プロジェクト: yehias/SharpRDP
 private void RdpConnectionOnOnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Console.WriteLine("[+] Connection closed     :  {0}", target);
     Environment.Exit(0);
 }
コード例 #31
0
ファイル: AxMSTSCLib.cs プロジェクト: huizh/xenadmin
 public virtual void OnDisconnected(int discReason) {
     IMsTscAxEvents_OnDisconnectedEvent ondisconnectedEvent = new IMsTscAxEvents_OnDisconnectedEvent(discReason);
     this.parent.RaiseOnOnDisconnected(this.parent, ondisconnectedEvent);
 }
コード例 #32
0
ファイル: RdpClient.cs プロジェクト: zxc2007/RdpChecker
 private void Rdp_OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e)
 {
     Respponse(ResponseType.Disconnected);
     OnReady(this);
 }