/// <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 { } } }
public NewsHandlerBeforeStateMoveCancelEventArgs(FeedSourceBusyState oldState, FeedSourceBusyState newState, bool cancel) : base(cancel) { this.OldState = oldState; this.NewState = newState; }
public NewsHandlerStateMovedEventArgs(FeedSourceBusyState oldState, FeedSourceBusyState newState) { this.OldState = oldState; this.NewState = newState; }