Example #1
0
 public static void RaiseEvent(TEvent e) where TEvent : IEvent
 {
     foreach (var handler in ObjectFactory.GetAllInstances <IHandle <TEvent> >())
     {
         handler.Handle(e);
     }
 }
        public static Task FireEventAsync <TEvent>() where TEvent : BaseMixpanelEvent
        {
            TEvent             expr_05   = Activator.CreateInstance <TEvent>();
            BaseMixpanelPeople thePeople = (BaseMixpanelPeople)Activator.CreateInstance(expr_05.PeopleType);

            return(MixpanelEventSender.FireEventAsync(expr_05, thePeople));
        }
            /// <summary>
            /// Adds a Transition to the collection for the specified event ID.
            /// </summary>
            /// <param name="eventId">
            /// The event ID associated with the Transition.
            /// </param>
            /// <param name="trans">
            /// The Transition to add.
            /// </param>
            /// <remarks>
            /// When a Transition is added to the collection, it is associated with
            /// the specified event ID. When a State receives an event, it looks up
            /// the event ID in its TransitionCollection to see if there are any
            /// Transitions for the specified event.
            /// </remarks>
            public void Add(TEvent eventId, Transition trans)
            {
                #region Preconditions

                if (trans.Source != null)
                {
                    throw new InvalidOperationException(
                              "This Transition has already been added to another State.");
                }

                #endregion

                // Set the transition's source.
                trans.Source = m_owner;

                // If there are no Transitions for the specified event ID.
                if (!m_transitions.ContainsKey(eventId))
                {
                    // Create new list of Transitions for the specified event ID.
                    m_transitions[eventId] = new List <Transition>();
                }

                // Add Transition.
                m_transitions[eventId].Add(trans);
            }
Example #4
0
 public EventActionNode(
     TEvent @event,
     TParam param)
 {
     this.Event = @event;
     this.Param = param;
 }
 private void NotifyEvent(TEvent aEvent)
 {
     if (StateChanged != null)
     {
         StateChanged(aEvent, this);
     }
 }
Example #6
0
        private void ReportEvent(TEvent aEvent)
        {
            // Ensure we only report significant events once
            if (EventHandler != null)
            {
                switch (aEvent)
                {
                case TEvent.EAlgorithmStarted:
                    if ((iFlags & TFlags.EFlagsReportedStarted) != TFlags.EFlagsReportedStarted)
                    {
                        iFlags |= TFlags.EFlagsReportedStarted;
                        EventHandler(this, aEvent);
                    }
                    break;

                case TEvent.EAlgorithmComplete:
                    if ((iFlags & TFlags.EFlagsReportedComplete) != TFlags.EFlagsReportedComplete)
                    {
                        iFlags |= TFlags.EFlagsReportedComplete;
                        EventHandler(this, aEvent);
                    }
                    break;

                default:
                    EventHandler(this, aEvent);
                    break;
                }
            }
        }
Example #7
0
 public TransitionNode(
     TEvent myEvent,
     TState state)
 {
     this.myEvent = myEvent;
     this.state   = state;
 }
Example #8
0
            public TState Execute(TContext context, TState state, TEvent @event)
            {
                var transition = _configuration.OnExecute;

                // no if here, we do want exception in such case
                return(transition(context, state, @event));
            }
Example #9
0
 public void ReportEvent(TEvent aEvent, object aData)
 {
     if (EventHandler != null)
     {
         EventHandler(aEvent, this, aData);
     }
 }
 private void NotifyEvent(TEvent aEvent)
 {
     if (Observer != null)
     {
         Observer(aEvent);
     }
 }
Example #11
0
 private void ReportEvent(TEvent aEvent, SymToken aToken)
 {
     if (LexerObservers != null)
     {
         LexerObservers(this, aEvent, aToken);
     }
 }
Example #12
0
 private void NotifyEvent(TEvent aEvent)
 {
     if (iObserver != null)
     {
         iObserver(aEvent, this);
     }
 }
        public static void FireEvent <TEvent>() where TEvent : BaseMixpanelEvent
        {
            TEvent             expr_05 = Activator.CreateInstance <TEvent>();
            BaseMixpanelPeople aCorrespondingPeopleProperty = (BaseMixpanelPeople)Activator.CreateInstance(expr_05.PeopleType);

            MixpanelEventSender.FireEvent(expr_05, aCorrespondingPeopleProperty);
        }
 public bool TryGetNode(
     TEvent @event,
     out EventNodePersisted <TKey, TState, TEvent, TCtx, TParam, TUserId> eventNode)
 {
     return(this.eventActLookup.TryGetValue(
                @event,
                out eventNode));
 }
Example #15
0
 public bool TryGetNode(
     TEvent @event,
     out EventNode <TState, TEvent, TCtx, TParam> eventNode)
 {
     return(this.eventActLookup.TryGetValue(
                @event,
                out eventNode));
 }
Example #16
0
 private void CanRotate(TEvent tEvent)
 {
     ManualRotate = bool.Parse(tEvent.eventParams[0].ToString());
     if (!ManualRotate)
     {
         AutoRotate = false;
     }
 }
            /// <inheritdoc />
            public Task <bool> RaiseAsync(TEvent @event)
            {
                if (@event is null)
                {
                    throw new ArgumentNullException(nameof(@event));
                }

                return(_owner.PerformTransitionAsync <Unit, TRelay>(@event, default, _backupValue));
Example #18
0
        protected TEvent AddEvent <TEvent>()
            where TEvent : IDomainEvent, new()
        {
            var @event = new TEvent();

            AddEvent(@event);
            return(@event);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransitionDictionary{TState, TEvent}.TransitionInfo"/> class.
 /// </summary>
 /// <param name="eventId">The event id.</param>
 /// <param name="source">The source.</param>
 /// <param name="target">The target.</param>
 /// <param name="guard">The guard.</param>
 /// <param name="actions">The actions.</param>
 public TransitionInfo(TEvent eventId, IState <TState, TEvent> source, IState <TState, TEvent> target, IGuardHolder guard, IEnumerable <ITransitionActionHolder> actions)
 {
     this.EventId = eventId;
     this.Source  = source;
     this.Target  = target;
     this.Guard   = guard;
     this.Actions = actions;
 }
Example #20
0
 /// <summary>
 /// 设置even
 /// </summary>
 /// <param name="eventName"></param>
 public void SetEventName(string eventName)
 {
     if (!string.IsNullOrEmpty(eventName))
     {
         data           = new TEvent(eventName);
         data.IsUseName = true;
     }
 }
Example #21
0
    public void Handle(TEvent evt)
    {
        if (!(evt is T))
        {
            throw new ArgumentException("This handler does not support the event type " + evt.GetType().FullName);
        }

        Handle((T)evt);
    }
Example #22
0
        private void sub_4AA8DC()
        {
            TEvent Event;

            Event = new TEvent(m_PEnvir, m_nCurrX, m_nCurrY, 1, 300000, true);// 5 * 60 * 1000
            M2Share.g_EventManager.AddEvent(Event);
            m_boFixedHideMode = false;
            SendRefMsg(Grobal2.RM_DIGUP, m_btDirection, m_nCurrX, m_nCurrY, Parse(Event), "");
        }
Example #23
0
            public void Trigger(TContext context, TState state, TEvent @event)
            {
                var trigger = _configuration.OnTrigger;

                if (trigger != null)
                {
                    trigger(context, state, @event);
                }
            }
            /// <inheritdoc />
            public bool Raise <T>(TEvent @event, T?argument)
            {
                if (@event is null)
                {
                    throw new ArgumentNullException(nameof(@event));
                }

                return(_owner.PerformTransitionSync(@event, argument, _backupValue));
            }
            /// <inheritdoc />
            public bool Raise(TEvent @event)
            {
                if (@event is null)
                {
                    throw new ArgumentNullException(nameof(@event));
                }

                return(_owner.PerformTransitionSync <Unit, TRelay>(@event, null, _backupValue));
            }
Example #26
0
        public int Send(TEvent @event)
        {
            foreach (var subscriber in _subscribers)
            {
                subscriber.Key(@event);
            }

            return(_subscribers.Count);
        }
Example #27
0
        public void ReportEvent(TEvent aEvent)
        {
            if (aEvent == TEvent.EReadingComplete)
            {
                iAlwaysActivatedCollections.BuildLookupCache();
            }

            ReportEvent(aEvent, null);
        }
Example #28
0
                public bool RaiseAsync <T>(TEvent @event, T?argument)
                {
                    if (@event is null)
                    {
                        throw new ArgumentNullException(nameof(@event));
                    }

                    return(_owner.RaiseAsyncInternal(@event, argument, _backupValue));
                }
            /// <summary>
            ///		Create a new <see cref="Publish"/> message.
            /// </summary>
            /// <param name="eventMessage">
            ///		The event message to publish.
            /// </param>
            public Publish(TEvent eventMessage)
            {
                if (eventMessage == null)
                {
                    throw new ArgumentNullException(nameof(eventMessage));
                }

                EventMessage = eventMessage;
            }
Example #30
0
            public OnEvents On <T0>(TEvent @event, Func <T0, bool> guard = default)
            {
                var onEvents = new OnEvents();

                ForEach(s =>
                {
                    onEvents.Add(s.On(@event, guard));
                });
                return(onEvents);
            }
 public void Add(TEvent tEvent)
 {
     repObject.AddEvent(tEvent);
 }
 public void AddEvent(TEvent tEvent)
 {
     tEvent.id = nextId++;
     events.Add(tEvent);
 }
Example #33
0
 public static extern int TV_GetEvent(ref TEvent ee);