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); }