예제 #1
0
 void AddTemporalContext(KeyTemporalContext tmpContext)
 {
     tmpContext.StartedTime = DateTime.Now;
     if (!contextTimer.Enabled)
     {
         contextTimer.Start();
     }
 }
예제 #2
0
        bool CheckContextExpired(KeyContext context)
        {
            bool expired = false;

            KeyTemporalContext tmpContext = context as KeyTemporalContext;

            if (tmpContext != null)
            {
                TimeSpan passedTime = DateTime.Now - tmpContext.StartedTime;
                expired = passedTime.TotalMilliseconds >= tmpContext.Duration;
                if (expired)
                {
                    App.Current.GUIToolkit.Invoke((sender, e) => tmpContext.ExpiredTimeAction());
                }
            }

            return(expired);
        }