示例#1
0
        /// <summary>
        /// Used to indicate that the application has
        /// transitioned form one state to another.
        /// </summary>
        /// <param name="newState"></param>
        public void MoveNewsHandlerStateTo(FeedSourceBusyState newState)
        {
            FeedSourceBusyState oldState = this._sourceBusyState;
            bool shouldCancel            = false;

            if (newState == oldState)                   // not really a new state
            {
                return;
            }

            if (NewsHandlerBeforeStateMove != null)
            {
                try
                {
                    NewsHandlerBeforeStateMoveCancelEventArgs args = new NewsHandlerBeforeStateMoveCancelEventArgs(oldState, newState, false);
                    NewsHandlerBeforeStateMove(this, args);
                    shouldCancel = args.Cancel;
                }
                catch { }
            }
            if (shouldCancel)
            {
                return;
            }

            this._sourceBusyState = newState;
            if (NewsHandlerStateMoved != null)
            {
                try
                {
                    NewsHandlerStateMoved(this, new NewsHandlerStateMovedEventArgs(oldState, newState));
                }
                catch { }
            }
        }
示例#2
0
 public NewsHandlerBeforeStateMoveCancelEventArgs(FeedSourceBusyState oldState, FeedSourceBusyState newState, bool cancel)
     : base(cancel)
 {
     this.OldState = oldState;
     this.NewState = newState;
 }
示例#3
0
 public NewsHandlerStateMovedEventArgs(FeedSourceBusyState oldState, FeedSourceBusyState newState)
 {
     this.OldState = oldState;
     this.NewState = newState;
 }