コード例 #1
0
        public bool RestartTimer(bool updateValue = false)
        {
            if (ValueChangedTimer == null)
            {
                return(false);
            }

            if (updateValue)
            {
                LastValue = Read(LastValue.Length,
                                 ValueChangedOffset);
            }

            ValueChangedTimer.Change(Frequency,
                                     Timeout.Infinite);

            bool ret = ValueChangedSuspended;

            ValueChangedSuspended = false;

            return(ret);
        }
コード例 #2
0
        public bool SuspendTimer()
        {
            ValueChangedMutex.WaitOne();

            try
            {
                if (ValueChangedSuspended)
                {
                    return(false);
                }

                ValueChangedTimer.Change(Timeout.Infinite,
                                         Timeout.Infinite);
                ValueChangedSuspended = true;

                return(true);
            }
            finally
            {
                ValueChangedMutex.ReleaseMutex();
            }
        }