Exemple #1
0
 private void Enable_Handle(object sender, object Relative_Lamp)
 {
     NationalInstruments.UI.WindowsForms.Switch SWI  = (NationalInstruments.UI.WindowsForms.Switch)sender;
     NationalInstruments.UI.WindowsForms.Led    lamp = (NationalInstruments.UI.WindowsForms.Led)Relative_Lamp;
     if (SWI.Value)
     {
         lamp.Value   = true;
         lamp.Enabled = true;
         Target       = lamp;
     }
     else
     {
         lamp.Value   = false;
         lamp.Enabled = false;
     }
 }
 //creating the switches
 public void CreateSwitches(List <Switch> labSwitches, string hostAddress)
 {
     foreach (Switch _switch in labSwitches)
     {
         NationalInstruments.UI.WindowsForms.Switch sw = new NationalInstruments.UI.WindowsForms.Switch();
         ((System.ComponentModel.ISupportInitialize)(sw)).BeginInit();
         sw.OffColor    = System.Drawing.Color.Blue;
         sw.OnColor     = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
         sw.Size        = new System.Drawing.Size(58, 77);
         sw.SwitchStyle = NationalInstruments.UI.SwitchStyle.HorizontalSlide3D;
         sw.TabIndex    = 5;
         sw.Value       = false;
         sw.Name        = _switch.Name;
         ((System.ComponentModel.ISupportInitialize)(sw)).EndInit();
         flowLayoutPanel1.Controls.Add(sw);
         sw.StateChanged += new NationalInstruments.UI.ActionEventHandler(switches_StateChanged);
         this.components.Add(sw);
         switch_creation_state = true;
     }
 }