private bool CheckServerList(ServerListParam aParam) { if (string.IsNullOrEmpty(aParam.A_서버명칭)) { MessageBox.Show(this, "서버명칭을 입력하세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (string.IsNullOrEmpty(aParam.B_IP주소)) { MessageBox.Show(this, "IP주소를 입력하세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (string.IsNullOrEmpty(aParam.C_사용자이름)) { MessageBox.Show(this, "사용자이름을 입력하세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } Regex regex = new Regex(@"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"); if (!regex.IsMatch(aParam.B_IP주소)) { MessageBox.Show(this, "입력하신 IP주소가 형식에 어긋납니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(true); }
private void ServerListDoubleClicked(object sender, Common.Definition.EventHandler.ServerListDoubleClickEventArgs e) { if (e.ServerListParam is ServerListParam) { ServerListParam param = e.ServerListParam as ServerListParam; this.StartRDP(param); } }
private void lvwServer_DoubleClick(object sender, EventArgs e) { string serverName = this.lvwServer.SelectedItems[0].Name; if (this.mServerList.Exists(server => server.A_서버명칭.Equals(serverName))) { ServerListParam param = this.mServerList.Find(server => server.A_서버명칭.Equals(serverName)); this.SetServerItemDoubleClicked(param); } }
private void StartRDP(ServerListParam aParam) { TabPage newPage = new TabPage(); LHJ.ServerInfoMonitor.RDP _RDP = new LHJ.ServerInfoMonitor.RDP(); newPage.Text = aParam.A_서버명칭 + " "; newPage.Controls.Add((Control)_RDP); this.tabControl1.TabPages.Add(newPage); this.tabControl1.SelectedTab = newPage; _RDP.BringToFront(); _RDP.Server = aParam.B_IP주소; _RDP.UserName = aParam.C_사용자이름; _RDP.ClearTextPassword = aParam.D_비밀번호; _RDP.RedirectDrives = aParam.B_RedirectDrives; _RDP.RedirectClipboard = aParam.C_RedirectClipboard; _RDP.RedirectPrinters = aParam.D_RedirectPrinters; _RDP.SmartSizing = aParam.E_SmartSizing; _RDP.FullScreen = aParam.A_FullScreen; _RDP.ContainerHandledFullScreen = false; _RDP.ConnectionBarShowMinimizeButton = false; Point desktopSize = this.GetDesktopSize(_RDP, aParam.F_DesktopSize, aParam.A_FullScreen); _RDP.DesktopWidth = desktopSize.X; _RDP.DesktopHeight = desktopSize.Y; _RDP.ConnectingText = string.Format("연결중...{0}[{1}]", aParam.A_서버명칭, aParam.B_IP주소); _RDP.DisconnectedText = string.Format("연결해제...{0}[{1}]", aParam.A_서버명칭, aParam.B_IP주소); if (aParam.G_ColorDepth.Contains("8")) { _RDP.ColorDepth = 8; } else if (aParam.G_ColorDepth.Contains("16")) { _RDP.ColorDepth = 16; } else if (aParam.G_ColorDepth.Contains("24")) { _RDP.ColorDepth = 24; } else if (aParam.G_ColorDepth.Contains("32")) { _RDP.ColorDepth = 32; } _RDP.Connect(); }
private void btnAdd_Click(object sender, EventArgs e) { ServerListParam param = (ServerListParam)this.propertyGridEx1.SelectedObject; if (!this.CheckServerList(param)) { return; } if (this.mServerList.Count > 0) { IEnumerable <ServerListParam> existList = from idx in this.mServerList where idx.A_서버명칭.Equals(param.A_서버명칭) select idx; if (existList.Count() > 0) { ServerListParam orgParam = this.mServerList.Find(server => server.A_서버명칭.Equals(param.A_서버명칭)); orgParam.A_FullScreen = param.A_FullScreen; orgParam.A_서버명칭 = param.A_서버명칭; orgParam.B_IP주소 = param.B_IP주소; orgParam.B_RedirectDrives = param.B_RedirectDrives; orgParam.C_RedirectClipboard = param.C_RedirectClipboard; orgParam.C_사용자이름 = param.C_사용자이름; orgParam.D_RedirectPrinters = param.D_RedirectPrinters; orgParam.D_비밀번호 = param.D_비밀번호; orgParam.E_SmartSizing = param.E_SmartSizing; orgParam.F_DesktopSize = param.F_DesktopSize; orgParam.G_ColorDepth = param.G_ColorDepth; } else { this.mServerList.Add(param); } } this.dtTolistView(this.ConvertToDatatable(this.mServerList), this.lvwServer); //this.btnInit.PerformClick(); }