void CallbackOnInboxStateChange(InboxState newState) { if (OnInboxStateChange != null) { OnInboxStateChange(newState); } }
private static Dictionary <string, string> GetKeywords(InboxState state) { Dictionary <string, string> d = new Dictionary <string, string>(); d.Add("State", state.ToString()); return(d); }
/// <summary> /// Raises the event /// </summary> /// <param name="caller">The caller of the event</param> /// <param name="e">The exception that caused the event</param> internal void InboxStateChange(InboxState newState) { if (OnInboxStateChange != null) { OnInboxStateChange(newState); } }
private void FromClosed(InboxState state) { switch (state) { case InboxState.Starting: break; default: throw new InboxIllegalStateTransactionException(_state, state); } }
private void FromStopping(InboxState state) { switch (state) { case InboxState.Closed: case InboxState.Faulted: break; default: throw new InboxIllegalStateTransactionException(_state, state); } }
private void FromListening(InboxState state) { switch (state) { case InboxState.AttemptingLogOn: case InboxState.Closing: case InboxState.Faulted: break; default: throw new InboxIllegalStateTransactionException(_state, state); } }
private void SetState(InboxState state) { switch (_state) { case InboxState.Initialized: FromInitialized(state); break; case InboxState.Starting: FromStarting(state); break; case InboxState.AttemptingLogOn: FromAttemptingLogon(state); break; case InboxState.Listening: FromListening(state); break; case InboxState.Closing: FromStopping(state); break; case InboxState.Closed: FromClosed(state); break; case InboxState.Faulted: FromFaulted(state); break; default: throw new InboxUnhandledStateException(_state); } _state = state; if (OnInboxStateChange != null) { OnInboxStateChange(_state); } logging.WCFLogger.Write(TraceEventType.Information, "Inbox changed state to " + state); }
private void FromFaulted(InboxState state) { throw new InboxIllegalStateTransactionException(_state, state); }
/// <summary> /// Constructor with keyword /// </summary> /// <param name="invalidState">The invalid state</param> public InboxInvalidStateException(InboxState invalidState) : base(GetKeywords(invalidState)) { }
void CallbackOnInboxStateChange(InboxState newState) { pContext.Binding.Elements.Find <EmailBindingElement>().InboxStateChange(newState); }
/// <summary> /// Constructor with keyword /// </summary> /// <param name="state">The unhandled state</param> public InboxUnhandledStateException(InboxState state) : base(GetKeywords(state)) { }
/// <summary> /// Constructor with keyword /// </summary> /// <param name="fromState">The state the inbox was in</param> /// <param name="toState">The state the inbox was going to</param> public InboxIllegalStateTransactionException(InboxState fromState, InboxState toState) : base(GetKeywords(fromState, toState)) { }