public SwitchPlayerControl(GangSwitchUnitDesign unitState, GangSwitchUnitConfig unitValue, int num) : this() { comboBoxAdv1.Items.Clear(); //всегда заполняется сначала значение для On, потом для Off - это важно, не меняйте порядок comboBoxAdv1.Items.AddRange(new string[] { unitValue.OnStateName, unitValue.OffStateName }); comboBoxAdv1.SelectedIndex = Convert.ToInt32(!unitState.OnOffState); comboBoxAdv1.Tag = num; autoLabel1.Text = unitValue.Name; }
public void AddSwitch(GangSwitchUnitDesign unitState, GangSwitchUnitConfig unitValue) { _countSwitch++; SwitchPlayerControl cntrl = new SwitchPlayerControl(unitState, unitValue, _countSwitch); cntrl.Location = new Point(1, (_countSwitch - 1) * 22 + 1); cntrl.Dock = DockStyle.Top; cntrl.Name = "switchNo" + _countSwitch.ToString(); cntrl.PushCommandButtonEvent += sendPushCommandButtonEvent; gpDetail.Controls.Add(cntrl); cntrl.BringToFront(); gpDetail.Refresh(); }
public GangSwitchUnitDescriptor(GangSwitchUnitDesign unit, Attribute[] attrs) : base(unit.Name, attrs) { this.unit = unit; }