Example #1
0
 private void TimerAlive_Tick(object sender, EventArgs e)
 {
     currentState = client.getHardwareState();
     if (currentState != null)
     {
         if (currentState.ledLight)
         {
             labelBlink.Visible = true;
         }
         else
         {
             labelBlink.Visible = false;
         }
         setCheckboxState(checkBox1, currentState.enabledF1);
         setCheckboxState(checkBox2, currentState.enabledF2);
         setCheckboxState(checkBox3, currentState.enabledF3);
         setCheckboxState(checkBox4, currentState.enabledF4);
         setCheckboxState(checkBox5, currentState.enabledF5);
         setCheckboxState(checkBox6, currentState.enabledF6);
     }
 }
Example #2
0
        private void TimerAlive_Tick(object sender, EventArgs e)
        {
            if (client.State == System.ServiceModel.CommunicationState.Faulted)
            {
                this.Close();
                return;
            }
            if (client.State == System.ServiceModel.CommunicationState.Opened)
            {
                try
                {
                    currentState = client.getHardwareState();

                    /*
                     * if (pwmGenerating)
                     * {
                     *  int period = int.Parse(textBoxPWMGenerate.Text);
                     *  int duty = int.Parse(textBoxDuty.Text);
                     *  if (lastSentPeriod!=period ||
                     *      lastSentDuty != duty)
                     *  {
                     *      sendNewPwmPeriodAndDuty();
                     *      lastSentPeriod = period;
                     *      lastSentDuty = duty;
                     *  }
                     * }
                     */
                }
                catch (Exception)
                {
                    this.Close();
                    return;
                }


                this.Invoke(() => {
                    if (currentState != null)
                    {
                        if (currentState.ledLight)
                        {
                            labelLed.BackColor = Color.Blue;
                        }
                        else
                        {
                            labelLed.BackColor = Color.Transparent;
                        }

                        lock (checkBoxLock)
                        {
                            checkBox1.SetChecked(currentState.enabledF1);
                            checkBox2.SetChecked(currentState.enabledF2);
                            checkBox3.SetChecked(currentState.enabledF3);
                            checkBox4.SetChecked(currentState.enabledF4);
                            checkBox5.SetChecked(currentState.enabledF5);
                            checkBox6.SetChecked(currentState.enabledF6);
                            checkBox10.SetChecked(currentState.enabledF10);
                        }
                        if (currentState.currentState == HardwareState.SearchState.Searching)
                        {
                            //textBoxCurrent.Text = currentState.currentPeriod.ToString();
                        }

                        freqChanger1.OnIncomingState(currentState);
                        freqChanger10.OnIncomingState(currentState);
                    }
                });
            }
        }
Example #3
0
 public HardwareState GetState()
 {
     return(new HardwareState(client.getHardwareState()));
 }