RoomEditorApp.JtTimer.Stop C# (CSharp) Method

Stop() public method

Stop the timer.
public Stop ( ) : void
return void
        public void Stop()
        {
            _timer.Stop();
              _duration = _timer.Elapsed.TotalSeconds;
              TimeRegistry.AddTime( _key, _duration );
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Toggle on and off subscription to
        /// automatic cloud updates.
        /// </summary>
        public static ExternalEvent ToggleSubscription(
            // EventHandler<IdlingEventArgs> handler
            IExternalEventHandler handler)
        {
            if (Subscribed)
            {
                Debug.Print("Unsubscribing...");
                //_uiapp.Idling -= _handler;
                //_handler = null;
                _event.Dispose();
                _event = null;

                _buttons[_subscribeButtonIndex].ItemText
                    = _subscribe;

                _timer.Stop();
                _timer.Report("Subscription timing");
                _timer = null;
                Debug.Print("Unsubscribed.");
            }
            else
            {
                Debug.Print("Subscribing...");
                //_uiapp.Idling += handler;
                //_handler = handler;
                _event = ExternalEvent.Create(handler);

                _buttons[_subscribeButtonIndex].ItemText
                    = _unsubscribe;

                _timer = new JtTimer("Subscription");
                Debug.Print("Subscribed.");
            }
            return(_event);
        }