Ejemplo n.º 1
0
        public void TimerCallback(UInt32 timer_id, UInt32 msg, UIntPtr user_ctx, UIntPtr reserve1, UIntPtr reserve2)
        {
            if (timer_id != this.TimerID)
            {
                throw new InvalidOperationException($"incoming timer id[{timer_id}] != my TimerID[{TimerID}] !!");
            }

            TimerEventArgs arg = new TimerEventArgs();

            LastTickTime = arg.SignalTime;

            OnTimer?.Invoke(this, arg);
        }
Ejemplo n.º 2
0
        public void FunctionTimer()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            while (EventStopWait.Wait(Period))
            {
                watch.Stop();
                if (watch.ElapsedMilliseconds >= Period)
                {
                    watch.Reset();
                    var arg = new TimerEventArgs();
                    this.LastSignalTime = arg.SignalTime;
                    OnTimer?.Invoke(this, arg);
                }
                watch.Start();
            }

            //multimedia
        }