void DestroyTab(IntPtr PanelHandle, RdpClientWindow parentForm) { Crownwood.Magic.Controls.TabPage thisPage = null; // destroy tag foreach (Crownwood.Magic.Controls.TabPage tabpage in tabMDIChild.TabPages) { if ((IntPtr)tabpage.Tag == PanelHandle) { Panel p = (Panel)tabpage.Control; p.Visible = true; p.Dock = DockStyle.Fill; p.Parent = parentForm; Application.DoEvents(); thisPage = tabpage; break; } } if (thisPage != null) { tabMDIChild.TabPages.Remove(thisPage); } // check if this form can be closed if (tabMDIChild.TabPages.Count == 0) { //this.Close(); } }
void CreateThumbnail(RdpClientWindow window) { Controls.RDThumbnail RDThumb = new Controls.RDThumbnail(); RDThumb.Title = window.Text; RDThumb.RDImage = window.GetCurrentScreen(); RDThumb.Visible = true; RDThumb.MDIChild_Handle = window.Handle; flowLayoutPanel1.Controls.Add(RDThumb); }
void ssw_ApplySettings(object sender, Database.ServerDetails sd) { RdpClientWindow rdpClientWin = GetClientWindowByTitleParams(sd.Username, sd.ServerName, sd.Server); if (rdpClientWin != null) { rdpClientWin.CurrentServer = sd; rdpClientWin.Reconnect(true, false, false); } }
public void PopOut(ref Panel panel, RdpClientWindow parentForm) { //panel.Dock = DockStyle.Fill; //panel.Parent = parentForm; IntPtr handle = panel.Handle; DestroyTab(handle, parentForm); parentForm.WindowState = FormWindowState.Normal; }
void clientWin_OnFormShown(object sender, EventArgs e, int ListIndex, IntPtr Handle) { RdpClientWindow rcw = (RdpClientWindow)sender; Crownwood.Magic.Controls.TabPage tabMDI = new Crownwood.Magic.Controls.TabPage(); //(rcw.Text, rcw.toolStrip1); tabMDI.Title = lvServerLists.Items[ListIndex].Text; tabMDI.ImageIndex = 0; tabMDI.Tag = rcw.Handle; rcw = null; tabMDI.Selected = true; tabMDIChild.TabPages.Add(tabMDI); GlobalHelper.MDIChildrens = this.MdiChildren; }
void ssw_ApplySettings(object sender, Database.ServerDetails sd) { RdpClientWindow rdpClientWin = GetClientWindowByTitleParams(sd.Username, sd.ServerName, sd.Server); if (rdpClientWin != null) { rdpClientWin._sd = sd; rdpClientWin.Reconnect(true, false, false); } else { MessageBox.Show("The relative RDP Client Window for this server does not exists.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
Rectangle ssw_GetClientWindowSize() { Database.ServerDetails sd = (Database.ServerDetails)lvServerLists.Items[this._selIndex].Tag; RdpClientWindow rdpClientWin = GetClientWindowByTitleParams(sd.Username, sd.ServerName, sd.Server); if (rdpClientWin != null) { return(rdpClientWin.rdpClient.RectangleToScreen(rdpClientWin.rdpClient.ClientRectangle)); } else { MessageBox.Show("The relative RDP Client Window for this server does not exists.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Rectangle r = new Rectangle(0, 0, sd.DesktopWidth, sd.DesktopHeight); return(r); } }
public RdpClientWindow GetClientWindowByTitleParams(params object[] args) { RdpClientWindow ret = null; string formTitlePattern = "Remote Desktop Client - {0}@{1}[{2}]"; string formTitle = string.Format(formTitlePattern, args); foreach (RdpClientWindow f in MdiChildren) { if (f.Text == formTitle) { ret = f; } } return(ret); }
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(); } } }
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(); } } }