public void AddLightGroup(LightUnitDesign unitState) { _countSwitch++; if (!_lightGroups.ContainsKey(unitState.Name)) _lightGroups.Add(unitState.Name, _countSwitch); _lightGroups[unitState.Name] = _countSwitch; //создание контролов LightGroupControl cntrl = new LightGroupControl(unitState, _countSwitch); cntrl.Location = new Point(1, (_countSwitch - 1) * 22 + 6); cntrl.Dock = DockStyle.Top; cntrl.OnLightGroupStateChanged += sendPushCommandButtonEvent; gpDetail.Controls.Add(cntrl); cntrl.BringToFront(); gpDetail.Refresh(); }
public LightGroupControl(LightUnitDesign unitValue, int num) : this() { if (unitValue.IsAdjustable) { trackBarEx1.Visible = true; comboBoxAdv1.Visible = false; trackBarEx1.Tag = (string)trackBarEx1.Tag + num.ToString(); } else { trackBarEx1.Visible = false; comboBoxAdv1.Visible = true; comboBoxAdv1.Tag = (string)comboBoxAdv1.Tag + num.ToString(); } alName.Text = unitValue.Name; UpdateValue(unitValue.Brightness); this.Name = "changeControl" + num.ToString(); }
public void UpdateView(bool isAvailable, LightUnitDesign unitState) { if (InvokeRequired) { Invoke(new Action<bool, LightUnitDesign>(UpdateView), isAvailable, unitState); return; } SetAvailableStatus(isAvailable); if (isAvailable) { Control[] res = this.Controls.Find("changeControl" + _lightGroups[unitState.Name].ToString(), true); if ((res != null) && (res.Length > 0)) { LightGroupControl cntrl = res[0] as LightGroupControl; if (cntrl != null) cntrl.UpdateValue(unitState.Brightness); } } }
public LightUnitDescriptor(LightUnitDesign unit, Attribute[] attrs) : base(unit.Name, attrs) { this.unit = unit; }