public void InitializeControls(Model_ServerDetails sd) { this.oldSD = sd; trw.AddRange(new Control[] { txServername, txComputer, txUsername, txDescription }); txServername.Text = sd.ServerName; txComputer.Text = sd.Server; txDomain.Text = sd.Domain; txPort.Text = sd.Port.ToString(); txUsername.Text = sd.Username; txPassword.Text = sd.Password; txDescription.Text = sd.Description; switch (sd.ColorDepth) { case 24: tbColor.Value = 1; break; case 16: tbColor.Value = 2; break; case 15: tbColor.Value = 3; break; case 8: tbColor.Value = 4; break; } tbColor_Scroll(tbColor, null); if (sd.DesktopWidth == 640 && sd.DesktopHeight == 480) { tbDeskSize.Value = 1; } else if (sd.DesktopWidth == 800 && sd.DesktopHeight == 600) { tbDeskSize.Value = 2; } else if (sd.DesktopWidth == 1024 && sd.DesktopHeight == 768) { tbDeskSize.Value = 3; } else if (sd.DesktopWidth == 1120 && sd.DesktopHeight == 700) { tbDeskSize.Value = 4; } else if (sd.DesktopWidth == 1152 && sd.DesktopHeight == 864) { tbDeskSize.Value = 5; } else if (sd.DesktopWidth == 1280 && sd.DesktopHeight == 800) { tbDeskSize.Value = 6; } else if (sd.DesktopWidth == 1280 && sd.DesktopHeight == 1024) { tbDeskSize.Value = 7; } tbColor_Scroll(tbColor, null); txWidth.Text = sd.DesktopWidth.ToString(); txHeight.Text = sd.DesktopHeight.ToString(); cbFullscreen.Checked = sd.Fullscreen; this.isUpdating = true; GlobalHelper.PopulateGroupsDropDown(ddGroup, GlobalHelper.dbGroups.GetGroupNameByID(sd.GroupID)); btnGetClientWinS.Enabled = true; }