Пример #1
0
 private void OnApplicationStateChanged(object sender, ApplicationStateEventArgs e)
 {
     if (e.CurrentState == ApplicationState.Started)
     {
         NotifyOfPropertyChange(() => StartupTime);
     }
 }
Пример #2
0
        public void ShouldConstructWithProperProperties()
        {
            const bool Expected = true;

            var args = new ApplicationStateEventArgs(Expected);

            Assert.AreEqual(Expected, args.Enabled);
        }
 private void OnExternalApplicationStateChanged(object sender, ApplicationStateEventArgs args)
 {
     if (Dispatcher.CheckAccess())
     {
         ProcessStateChanged(args);
     }
     else
     {
         Dispatcher.Invoke(new Action(() => ProcessStateChanged(args)));
     }
 }
        private void ProcessStateChanged(ApplicationStateEventArgs args)
        {
            switch (args.State)
            {
            case ApplicationState.Started:
                ApplicationRunning = true;
                break;

            case ApplicationState.Terminated:
                ApplicationRunning = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }