private void ToggleReg(LedBulb bulb, Button btnreg, Button btnunreg, int status) { if (status == 1) { bulb.Color = Color.LawnGreen; bulb.On = true; btnreg.Enabled = false; btnunreg.Enabled = true; } else if (status == -1) { bulb.Color = Color.Red; bulb.On = true; btnreg.Enabled = true; btnunreg.Enabled = true; } else { bulb.Color = Color.LawnGreen; bulb.On = false; btnreg.Enabled = true; btnunreg.Enabled = false; } }
private void CheckFolderHandler() { if (SearchControl("bulbFolder", gbFolderHandler) == null) { LedBulb bulbFolder = new LedBulb(); bulbFolder.Location = new System.Drawing.Point(20, 15); bulbFolder.Color = System.Drawing.Color.LawnGreen; bulbFolder.Size = new System.Drawing.Size(25, 20); bulbFolder.On = false; bulbFolder.Name = "bulbFolder"; gbFolderHandler.Controls.Add(bulbFolder); } int FolderHandler = 0; try { FolderHandler = RegistryOperations.CheckFolderHandler; } catch (Exception ex) { ex.ToString(); } Control ctrl = SearchControl("bulbFolder", gbFolderHandler); ToggleReg((LedBulb)ctrl, btnRegFolder, btnUnregFolder, FolderHandler); }
private void DisplayFlags(IDictionary <string, bool> flags) { foreach (CheckBox checkBox in groupBoxFlags.Controls) { checkBox.Checked = flags[checkBox.Tag.ToString()]; } foreach (Control c in groupBoxLedFlags.Controls) { if (c.GetType() == typeof(LedBulb)) { LedBulb lb = c as LedBulb; lb.On = flags[lb.Tag.ToString()]; } } }