示例#1
0
        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;
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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()];
                }
            }
        }