Пример #1
0
        private void SetWDTimerBtn_Click(object sender, EventArgs e)
        {
            UInt16 LastErrCode;

            if (Convert.ToInt32(SetWDTimerTxt.Text) > 0xFFFF)
            {
                MessageBox.Show("Invalid value of timer.");
                return;
            }

            LastErrCode = Watch_Dog_API.WD_SetTime(Convert.ToUInt16(SetWDTimerTxt.Text));
            if (LastErrCode != IMC_ERR_NO_ERROR)
            {
                MessageBox.Show("Fails to set timer time to Watch Dog");
                return;
            }
        }
Пример #2
0
        private void SetWDTimerBtn_Click(object sender, EventArgs e)
        {
            UInt16 LastErrCode;
            ushort countdown_time;

            try
            {
                countdown_time = Convert.ToUInt16(SetWDTimerTxt.Text);
            }
            catch
            {
                MessageBox.Show("Format incorrect.");
                return;
            }
            LastErrCode = Watch_Dog_API.WD_SetTime(countdown_time);
            if (LastErrCode != IMC_ERR_NO_ERROR)
            {
                MessageBox.Show("Fails to set timer time to Watch Dog");
                return;
            }
        }