コード例 #1
0
 private void checkBoxDirection_CheckedChanged(object sender, EventArgs e)
 {
     try {
         if (checkBoxDirection.Checked) {
             m_channel.SetChannelDirection(IODirection.Output);
             m_channel.WriteBit(State);
         }
         else {
             m_channel.SetChannelDirection(IODirection.Input);
             State = m_channel.ReadBit();
             SetUIState(State);
         }
     }
     catch { }
 }
コード例 #2
0
 private void SwitchState()
 {
     if (State == IOBitState.Low)
         State = IOBitState.High;
     else
         State = IOBitState.Low;
 }
コード例 #3
0
        internal void UpdateState(bool AITestDirection)
        {
            IODirection dir = m_channel.GetChannelDirection();
            if (AITestDirection) {
                //try{
                //     if (dir == IODirection.Input)
                //         m_channel.SetChannelDirection(IODirection.Output);
                //       else
                //         m_channel.SetChannelDirection(IODirection.Input);
                //     m_channel.SetChannelDirection(dir);
                // }
                //catch{
                //    checkBoxDirection.Enabled = false;
                //    if (dir == IODirection.Output)
                //        m_channel.WriteBit(State);
                //}
                if (m_channel.IsDirectionFixed()) {
                    checkBoxDirection.Enabled = false;

                }

            }
            if (dir == IODirection.Input)
                checkBoxDirection.Checked = false;
            else
                checkBoxDirection.Checked = true;
            if (!checkBoxDirection.Checked)
                State = m_channel.ReadBit();
            SetUIState(State);
        }
コード例 #4
0
 private void SetUIState(IOBitState state)
 {
     if (state == IOBitState.High) {
         labelState.Text = "HI";
         labelState.BackColor = Color.Yellow;
         labelState.ForeColor = Color.Black;
     }
     else {
         labelState.Text = "LO";
         labelState.BackColor = Color.Black;
         labelState.ForeColor = Color.Yellow;
     }
 }