예제 #1
0
        public void Connect()
        {
            object x = new object();

            lock (x)
            {
                Model_ServerDetails sd = (Model_ServerDetails)lvServerLists.Items[this._selIndex].Tag;

                bool   canCreateNewForm = true;
                string formTitlePattern = "Remote Desktop Client - {0}@{1}[{2}]";
                string formTitle        = string.Format(formTitlePattern, sd.Username, sd.ServerName, sd.Server);

                foreach (Form f in this.MdiChildren)
                {
                    if (f.Text == formTitle)
                    {
                        f.Activate();
                        canCreateNewForm = false;
                        break;
                    }
                }

                if (canCreateNewForm)
                {
                    RdpClientWindow clientWin = new RdpClientWindow(sd, this);
                    clientWin.Connected             += new Connected(clientWin_Connected);
                    clientWin.Connecting            += new Connecting(clientWin_Connecting);
                    clientWin.LoginComplete         += new LoginComplete(clientWin_LoginComplete);
                    clientWin.Disconnected          += new Disconnected(clientWin_Disconnected);
                    clientWin.OnFormShown           += new OnFormShown(clientWin_OnFormShown);
                    clientWin.OnFormClosing         += new OnFormClosing(clientWin_OnFormClosing);
                    clientWin.OnFormActivated       += new OnFormActivated(clientWin_OnFormActivated);
                    clientWin.ServerSettingsChanged += new ServerSettingsChanged(clientWin_ServerSettingsChanged);
                    clientWin.Text      = formTitle;
                    clientWin.MdiParent = this;
                    System.Diagnostics.Debug.WriteLine(this.Handle);
                    clientWin.ListIndex = this._selIndex;
                    clientWin.Show();
                    clientWin.BringToFront();
                    clientWin.Connect();
                }
            }
        }
예제 #2
0
        public void Connect()
        {
            object x = new object();

            lock (x)
            {
                Database.ServerDetails sd = (Database.ServerDetails)lvServerLists.Items[this._selIndex].Tag;

                bool canCreateNewForm = true;
                string formTitlePattern = "Remote Desktop Client - {0}@{1}[{2}]";
                string formTitle = string.Format(formTitlePattern, sd.Username, sd.ServerName, sd.Server);

                foreach (Form f in this.MdiChildren)
                {
                    if (f.Text == formTitle)
                    {
                        f.Activate();
                        canCreateNewForm = false;
                        break;
                    }
                }

                if (canCreateNewForm)
                {
                    RdpClientWindow clientWin = new RdpClientWindow(sd, this);
                    clientWin.Connected += new Connected(clientWin_Connected);
                    clientWin.Connecting += new Connecting(clientWin_Connecting);
                    clientWin.LoginComplete += new LoginComplete(clientWin_LoginComplete);
                    clientWin.Disconnected += new Disconnected(clientWin_Disconnected);
                    clientWin.OnFormShown += new OnFormShown(clientWin_OnFormShown);
                    clientWin.OnFormClosing += new OnFormClosing(clientWin_OnFormClosing);
                    clientWin.OnFormActivated += new OnFormActivated(clientWin_OnFormActivated);
                    clientWin.ServerSettingsChanged += new ServerSettingsChanged(clientWin_ServerSettingsChanged);
                    clientWin.Text = formTitle;
                    clientWin.MdiParent = this;
                    System.Diagnostics.Debug.WriteLine(this.Handle);
                    clientWin.ListIndex = this._selIndex;
                    clientWin.Show();
                    clientWin.BringToFront();
                    clientWin.Connect();
                }
            }
        }