private void BuildBustMainTab() { // screen up and screen down are special case constants GUCTechTools.Pages.CustomRoomControls.MainTab stdMainTab = new GUCTechTools.Pages.CustomRoomControls.MainTab(); GroupBox capturedGB = new GroupBox(); Grid capturedGrid = new Grid(); DataTable dt = ((MainWindow)Application.Current.MainWindow)._1337; var IPs = (from row in dt.AsEnumerable() where row.Field <string>("Building").Contains(cbBuilding.SelectedItem.ToString()) where row.Field <string>("Room") == cbRoom.SelectedItem.ToString() select row["IP"].ToString()).ToList(); string controllerIP = IPs.ElementAt(0); string tag = ((MainWindow)Application.Current.MainWindow)._1337.FindByIP(controllerIP).Tag; ControllerGuc.Connect(controllerIP, 8888); foreach (var item in stdMainTab.controlGrid.Children) { if (item.GetType() == typeof(GroupBox)) { continue; } else if (((Button)item).Content.ToString() == "Screen Up") { ((Button)item).Click += ((sender, e) => { ControllerGuc.SendHTTPCommand("", 8888, ""); }); } else if (((Button)item).Content.ToString() == "Screen Down") { ((Button)item).Click += ((sender, e) => { ControllerGuc.SendHTTPCommand("", 8888, ""); }); } else { ((Button)item).Click += Button_Click; } } mainTab.Content = stdMainTab; }
private void BuildStandardMainTab() { GUCTechTools.Pages.CustomRoomControls.MainTab stdMainTab = new GUCTechTools.Pages.CustomRoomControls.MainTab(); GroupBox capturedGB = new GroupBox(); Grid capturedGrid = new Grid(); foreach (var item in stdMainTab.controlGrid.Children) { if (item.GetType() == typeof(GroupBox)) { continue; } else { ((Button)item).Click += Button_Click; } } mainTab.Content = stdMainTab; }