コード例 #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);
        }
コード例 #3
0
 private void OnExternalApplicationStateChanged(object sender, ApplicationStateEventArgs args)
 {
     if (Dispatcher.CheckAccess())
     {
         ProcessStateChanged(args);
     }
     else
     {
         Dispatcher.Invoke(new Action(() => ProcessStateChanged(args)));
     }
 }
コード例 #4
0
        private void ProcessStateChanged(ApplicationStateEventArgs args)
        {
            switch (args.State)
            {
            case ApplicationState.Started:
                ApplicationRunning = true;
                break;

            case ApplicationState.Terminated:
                ApplicationRunning = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }