Example #1
0
        // This function is called when the textbox holding the value of the
        // number of channels is changed by the user. The default value is set
        // to 4 channels. If nothing is changed, the function returns. If an
        // invalid number of channels is chosen, the number of channels to to
        // be read is reset to 4, and an error message is displayed.
        private void NumChannels_TextChanged(object sender, EventArgs e)
        {
            if (!user_change)
            {
                return;
            }

            try
            {
                if ((Convert.ToInt32(NumChannels.Text) < 0) || (Convert.ToInt32
                                                                    (NumChannels.Text) > 7))
                {
                    throw new Exception();
                }

                LASTCHANNEL = Convert.ToInt32(NumChannels.Text) - 1;
            }

            catch
            {
                MessageBox.Show("Invalid Number of Temperature Input Channels.\n\nValue must be between 1 and 8.");
                LASTCHANNEL           = 3;
                user_change           = false;
                this.NumChannels.Text = Convert.ToString(LASTCHANNEL + 1);
                user_change           = true;
            }

            Ch0.Clear();
            Ch1.Clear();
            Ch2.Clear();
            Ch3.Clear();
            Ch4.Clear();
            Ch5.Clear();
            Ch6.Clear();
            Ch7.Clear();

            // Reset the default value of the boolean variable user_change.
            user_change = true;
        }
Example #2
0
 public ChannelViewModel(Ch2 ch)
 {
     this.mCH = ch;
 }
Example #3
0
 static void Main(string[] args)
 {
     chapter2.Ch2 ch2 = new Ch2();
     ch2.practice_1();
 }