Ejemplo n.º 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);
            }
Ejemplo n.º 4
0
 public EventActionNode(
     TEvent @event,
     TParam param)
 {
     this.Event = @event;
     this.Param = param;
 }
Ejemplo n.º 5
0
 private void NotifyEvent(TEvent aEvent)
 {
     if (StateChanged != null)
     {
         StateChanged(aEvent, this);
     }
 }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 7
0
 public TransitionNode(
     TEvent myEvent,
     TState state)
 {
     this.myEvent = myEvent;
     this.state   = state;
 }
Ejemplo n.º 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));
            }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 11
0
 private void ReportEvent(TEvent aEvent, SymToken aToken)
 {
     if (LexerObservers != null)
     {
         LexerObservers(this, aEvent, aToken);
     }
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 15
0
 public bool TryGetNode(
     TEvent @event,
     out EventNode <TState, TEvent, TCtx, TParam> eventNode)
 {
     return(this.eventActLookup.TryGetValue(
                @event,
                out eventNode));
 }
Ejemplo n.º 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));
Ejemplo n.º 18
0
        protected TEvent AddEvent <TEvent>()
            where TEvent : IDomainEvent, new()
        {
            var @event = new TEvent();

            AddEvent(@event);
            return(@event);
        }
Ejemplo n.º 19
0
 /// <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;
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 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), "");
        }
Ejemplo n.º 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));
            }
Ejemplo n.º 26
0
        public int Send(TEvent @event)
        {
            foreach (var subscriber in _subscribers)
            {
                subscriber.Key(@event);
            }

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

            ReportEvent(aEvent, null);
        }
Ejemplo n.º 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));
                }
Ejemplo n.º 29
0
            /// <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;
            }
Ejemplo n.º 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);
 }
Ejemplo n.º 33
0
 public static extern int TV_GetEvent(ref TEvent ee);