Example #1
0
        public void btnSet_MouseUp(object sender, MouseEventArgs e)
        {
            if (m_ButtonStart == 0)
            {
                return;
            }
            int time = Environment.TickCount - m_ButtonStart;

            m_ButtonStart = 0;
            if (time <= 0 || time > 10000)
            {
                Console.Beep();
            }
            else
            {
                Value = time;
                UserChangedValue?.Invoke(this, EventArgs.Empty);
            }
            m_ButtonStart = 0;             // otherwise it beeps on mouse leave
        }
Example #2
0
        public void txtTime_TextChanged(object sender, EventArgs e)
        {
            if (m_Filling)
            {
                return;
            }
            float time;

            //exits on success
            if (float.TryParse(txtTime.Text, out time))
            {
                if (time >= 0 && time < 10)
                {
                    txtTime.BackColor = Color.White;
                    m_Value           = (int)(time * 1000);
                    UserChangedValue?.Invoke(this, EventArgs.Empty);
                    return;
                }
            }
            // failed
            txtTime.BackColor = Color.Tomato;
        }