예제 #1
0
파일: Protocol.cs 프로젝트: EBassie/Potato
        protected void OnProtocolEvent(ProtocolEventType eventType, IProtocolStateDifference difference, IProtocolEventData now = null, IProtocolEventData then = null)
        {
            var handler = this.ProtocolEvent;

            if (handler != null) {
                handler(
                    this,
                    new ProtocolEventArgs() {
                        ProtocolEventType = eventType,
                        ProtocolType = this.ProtocolType as ProtocolType, // Required for serialization. How to get around?
                        StateDifference = difference ?? new ProtocolStateDifference(),
                        Now = now ?? new ProtocolEventData(),
                        Then = then ?? new ProtocolEventData()
                    }
                );
            }
        }
예제 #2
0
파일: Protocol.cs 프로젝트: EBassie/Potato
 /// <summary>
 /// Helper to apply the difference generated from an event.
 /// </summary>
 /// <param name="difference">The difference object to apply to the protocols state</param>
 protected void ApplyProtocolStateDifference(IProtocolStateDifference difference)
 {
     if (this.State != null) {
         // Apply any differences to our state object.
         this.State.Apply(difference);
     }
 }