コード例 #1
0
ファイル: FNetPA.cs プロジェクト: alexbzg/JeromeControl
 private void controllerLineStateChanged(object sender, LineStateChangedEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.line.ToString() + " " + e.state.ToString());
     if (controllerTemplate.limits.ContainsValue(e.line))
     {
         if (e.state == 0)
         {
             System.Diagnostics.Debug.WriteLine("Limit");
             if (e.line == controllerTemplate.limits[-1])
             {
                 limit = -1;
             }
             else
             {
                 limit = 1;
             }
             if (target == -1 || target == position)
             {
                 activeConnection.controller.switchLine(controllerTemplate.enable, 1);
                 activeConnection.controller.switchLine(controllerTemplate.pulse, 0);
             }
             else
             {
                 rotate(target);
             }
         }
         else
         {
             limit = 0;
         }
     }
 }
コード例 #2
0
 private void lineStateChanged(object sender, LineStateChangedEventArgs e)
 {
     if (currentTemplate.limitsLines.Values.Contains(e.line))
     {
         if (e.state == 0)
         {
             int dir = currentTemplate.limitsLines.SingleOrDefault(x => x.Value == e.line).Key;
             onLimit(dir);
         }
         else if (slCalibration.Text == "Концевик")
         {
             this.Invoke((MethodInvoker) delegate
             {
                 slCalibration.Visible = false;
             });
         }
     }
 }
コード例 #3
0
ファイル: WX0B.cs プロジェクト: alexbzg/JeromeControl
 private void TerminalJConnectionLineStateChanged(object sender, LineStateChangedEventArgs e)
 {
     if (e.line == TerminalTemplate.pttButton)
     {
         if (e.state != pttState)
         {
             pttState = e.state;
             updateTX();
         }
     }
     else if (!tx && e.line == TerminalTemplate.lockButton)
     {
         if (e.state != lockButtonState)
         {
             lockButtonState = e.state;
             if (e.state == 0)
             {
                 lockSwitch = lockSwitch == null ? activeSwitch : null;
                 displayLockSwitch();
             }
         }
     }
     else if (!tx)
     {
         KeyValuePair <WX0BTerminalSwitchTemplate, WX0BTerminalSwitch> kv = switches.Where(x => x.Key.button == e.line).FirstOrDefault();
         if (kv.Key != null && kv.Value.lineState != e.state)
         {
             kv.Value.lineState = e.state;
             if (e.state == 0)
             {
                 switchLeds(activeSwitch, kv.Value);
                 activeSwitch = kv.Value;
                 displayActiveSwitch();
                 updateController(activeSwitch);
             }
         }
     }
 }