Exemple #1
0
        public void Setup()
        {
            _eventsOccured = 0;
            _tm            = Substitute.For <ITrackManager>();

            _uut = new EventList(_tm);

            //TODO: loop and use list or other collection of tracks
            ITrack track1 = Substitute.For <ITrack>();

            track1.Tag       = "1";
            track1.Timestamp = DateTime.MaxValue;

            ITrack track2 = Substitute.For <ITrack>();

            track2.Tag       = "2";
            track2.Timestamp = DateTime.MaxValue;

            _event = Substitute.For <SeperationEvent>(track1, track2);

            _uut.CurrEvents = Substitute.For <List <IEvent> >();
            _uut.CurrEvents.Add(_event);

            _uut.RaiseEventsUpdatedEvent += (o, args) =>
            {
                _eventArgs = args.Events;
                _eventsOccured++;
            };
        }
Exemple #2
0
        public EventListScreenViewModel(
            IConcurrencyService concurrencyService,
            ISelectionService selectionService,
            IEventList eventList)
        {
            eventList.WhenEventSelectionChanges.Subscribe(selectionService.ChangeSelection);
            eventList.IncludeInputObservables = this.WhenAnyValue(x => x.IncludeInputObservables)
                                                .ObserveOn(concurrencyService.TaskPoolRxScheduler);

            EventList = eventList;

            this.WhenActivated(disposables =>
            {
                var observablesForCalls = mDocument.Calls
                                          .ObserveOn(concurrencyService.TaskPoolRxScheduler)
                                          .TakeWhile(change => change.Removes == 0) // stop if any calls removed
                                          .MergeMany(call => call.ObservableInstances)
                                          .ToObservableChangeSet(obs => obs.ObservableId)
                                          .Repeat(); // reset after calls removed

                eventList.Observables = mDocument.Observables.Or(observablesForCalls);

                eventList.Activator.Activate().DisposeWith(disposables);
            });
        }
Exemple #3
0
        public CompositeActionBuilder(Stock stock, Guid id, Date recordDate, string description, Action <CompositeActionAddedEvent> callback)
        {
            _ChildEvents  = new EventList();
            _ChildActions = new CorporateActionList(stock, _ChildEvents);

            _Event    = new CompositeActionAddedEvent(stock.Id, stock.Version, id, recordDate, description);
            _Callback = callback;
        }
Exemple #4
0
        public TrackRenderer(ITrackManager trackManager, IEventList eventList, IConsole console = null)
        {
            _currTracks = new List <ITrack>();
            _currEvents = new List <IEvent>();

            _console = console ?? new WrapThat.SystemBase.Console(); //if null defaults to normal Console

            trackManager.RaiseTracksUpdatedEvent += HandleTrackUpdate;
            eventList.RaiseEventsUpdatedEvent    += HandleEventUpdate;
        }
        internal bool RemoveListener(uint id) {
            if (!this.listenersById.ContainsKey(id)) {
                return false;
            }

            IEventList eventList = this.listenersById[id];
            eventList.Remove(id);
            this.listenersById.Remove(id);
            return true;
        }
Exemple #6
0
        public void SetUp()
        {
            receiver     = TransponderReceiver.TransponderReceiverFactory.CreateTransponderDataReceiver();
            tm           = new TrackManager();
            el           = new EventList(tm);
            _tf          = new TrackFormatter();
            evntDetector = new SeperationEventDetector(el, tm);
            client       = new TransponderRecieverClient(receiver, _tf, tm);
            _console     = Substitute.For <WrapThat.SystemBase.IConsole>();

            tr = new TrackRenderer(tm, el, _console);
        }
        internal void Clear<T>() where T : EventArgs {
            Type type = typeof(T);
            if (!this.listenersByType.ContainsKey(type)) {
                return;
            }

            IEventList eventList = this.listenersByType[type];
            uint[] ids = eventList.Ids;
            foreach (uint id in ids) {
                this.listenersById.Remove(id);
            }
            eventList.Clear();
        }
Exemple #8
0
        private void RunCommands(string name, byte[] data)
        {
            IEventList eventList = null;

            lock (commandsLock)
                if (CommandEvents.ContainsKey(name))
                {
                    eventList = CommandEvents[name];
                    eventList.Prepare();
                }

            eventList?.Invoke(data);
        }
 internal void Dispatch<T>(object sender, T eventArgs, float delay) where T : EventArgs {
     Type objectType = typeof(object);
     Type iterator = eventArgs.GetType();
     do {
         Type type = iterator;
         iterator = iterator.BaseType;
         if (!this.listenersByType.ContainsKey(type)) {
             continue;
         }
         IEventList eventList = this.listenersByType[type];
         Action[] invocationList = eventList.GetInvocationList(sender, eventArgs);
         if (invocationList == null) {
             continue;
         }
         foreach (Action action in invocationList) {
             this.StartCoroutine(this.ExecuteDispatch(action, delay));
         }
     } while (iterator != objectType && iterator != null);
 }
Exemple #10
0
        public void Setup()
        {
            _tracks = Substitute.For <List <ITrack> >();

            var track = Substitute.For <ITrack>();

            track.Tag      = "0";
            track.XPos     = 0;
            track.YPos     = 0;
            track.Altitude = 0;


            _tracks.Add(track);

            _el = Substitute.For <IEventList>();
            _tm = Substitute.For <ITrackManager>();

            _uut = new SeperationEventDetector(_el, _tm);
        }
        public QuickEventListDialogViewModel(IEventList eventList)
        {
            eventList.IncludeInputObservables = this.WhenAnyValue(x => x.IncludeInputObservables);
            EventList = eventList;

            var whenUserCancels = CommandHelper.CreateTriggerCommand(out var cancelCommand);

            CancelCommand = cancelCommand;

            this.WhenActivated((CompositeDisposable disposables) =>
            {
                DisplayName            = $"{Title} - events";
                eventList.Observables  = Observables;
                eventList.ClientEvents = ClientEvents;

                eventList.Activator.Activate().DisposeWith(disposables);

                whenUserCancels.Subscribe(_ => Cancel()).DisposeWith(disposables);
            });
        }
Exemple #12
0
        /// <summary>
        /// Unregisters all event names in a simple events class
        /// </summary>
        /// <param name="eventSystem"></param>
        /// <param name="eventList"></param>
        public static void UnregisterEvents(IEventSystem eventSystem, IEventList eventList)
        {
            if (eventSystem == null)
            {
                throw new ArgumentNullException(nameof(eventSystem));
            }

            if (eventList == null)
            {
                throw new ArgumentNullException(nameof(eventList));
            }

            foreach (var name in eventList.SimpleEvents)
            {
                eventSystem.UnregisterEvent(name);
            }

            foreach (var eventType in eventList.EventTypes)
            {
                eventSystem.UnregisterEvent(EventName(eventType));
            }
        }
Exemple #13
0
        public void Setup()
        {
            _track  = Substitute.For <ITrack>();
            _tracks = Substitute.For <List <ITrack> >();
            _tracks.Add(_track);

            _events = Substitute.For <List <IEvent> >();
            var evnt = Substitute.For <IEvent>();

            evnt.InvolvedTracks    = new ITrack[1]; //Can't substitute for array of ITrack
            evnt.InvolvedTracks[0] = _track;
            evnt.TimeOfOccurence   = _track.Timestamp;
            _events.Add(evnt);

            _eventsRecieved = 0;

            _tm = Substitute.For <ITrackManager>();
            _el = Substitute.For <IEventList>();


            _console = Substitute.For <WrapThat.SystemBase.IConsole>();

            _uut = new TrackRenderer(_tm, _el, _console);
        }
Exemple #14
0
        public void Setup()
        {
            _track  = new Track("tag", 20000, 20000, 600, new DateTime());
            _tracks = new List <ITrack>();
            _tracks.Add(_track);
            airspace = new Airspace(10000, 90000, 10000, 90000, 500, 20000);
            _events  = new List <IEvent>();
            var evnt = new EntryEvent(_track);

            //evnt.InvolvedTracks = new ITrack[1]; //Can't substitute for array of ITrack
            //evnt.InvolvedTracks[0] = _track;
            //evnt.TimeOfOccurence = _track.Timestamp;
            _events.Add(evnt);

            _eventsRecieved = 0;

            _tm = new TrackManager();
            _el = new EventList(_tm);


            _console = Substitute.For <WrapThat.SystemBase.IConsole>();

            _uut = new TrackRenderer(_tm, _el, _console);
        }
Exemple #15
0
 internal CorporateActionList(Stock stock, IEventList eventList)
 {
     _Stock  = stock;
     _Events = eventList;
 }
 public SeperationEventDetector(IEventList eventList, ITrackManager trackManager) //TODO: Update to use event to renderer instead of this.
 {
     events = eventList;
     trackManager.RaiseTracksUpdatedEvent += HandleTrackUpdate;
 }
Exemple #17
0
 public EventsController(IEventList eventList, ILogger <EventsController> logger)
 {
     _eventList = eventList;
     _logger    = logger;
 }
 public EventSyntaxReader(IEventList events, SemanticModel semantic) : base(semantic)
 {
     _events = events;
 }
Exemple #19
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 public Blackboard()
 {
     // создаём локальный список событий
     _eventList = EventListFactory.CreateEventList();
     _localEventsSubscribers = new LocalEventsSubscribersList();
 }
 public EventSymbolReader(IEventList events)
 {
     _events = events;
 }