Пример #1
0
 internal void CallEvent(EventModelBase model)
 {
     foreach (var item in _targets[model.GetType()])
     {
         item.DynamicInvoke(model);
     }
 }
Пример #2
0
        private void ReplayEvent(EventModelBase modelBase, float currentTimeSinceStartSeconds)
        {
            var eventType   = modelBase.EventType;
            var instruction = _replayInstructions.Find(instr => instr.Name == eventType);

            if (instruction != null)
            {
                if (!instruction.EnableReplay)
                {
                    if (modelBase is ComponentEventModel comp)
                    {
                        _debugger.Log($"Replay disabled time:{currentTimeSinceStartSeconds:0.00}, type:{comp.EventType}, gameObject:{comp.GameObjectName}, comp:{comp.ComponentType}");
                    }
                    else
                    {
                        _debugger.Log($"Replay disabled time:{currentTimeSinceStartSeconds:0.00}, type:{modelBase.EventType}");
                    }
                    return;
                }

                if (modelBase is ComponentEventModel compo)
                {
                    _debugger.Log($"Replaying Event: time:{currentTimeSinceStartSeconds:0.00}, type:{compo.EventType}, gameObject:{compo.GameObjectName}, comp:{compo.ComponentType}");
                }
                else
                {
                    _debugger.Log($"Replaying Event: time:{currentTimeSinceStartSeconds:0.00}, type:{modelBase.EventType}");
                }

                instruction.Replay(modelBase);
                return;
            }

            _debugger.LogWarning($"No event type found named:{eventType}");
        }
Пример #3
0
        public IList <EventModelBase> GetItemsFromCsvFile()
        {
            string path = PathFinder.GetPathToCsvDb();

            if (path == null)
            {
                throw new InvalidOperationException("path");
            }
            if (!File.Exists(path))
            {
                throw new InvalidOperationException("path doesn't exist");
            }

            StreamReader          reader = new StreamReader(path);
            List <EventModelBase> events = new List <EventModelBase>();

            while (reader.Peek() >= 0)
            {
                string content = reader.ReadLine();

                EventModelBase newEvent = _parser.ParseRow(content);

                if (newEvent != null)
                {
                    events.Add(newEvent);
                }
            }

            return(events);
        }
Пример #4
0
        public bool UpdateEvent(EventModelBase eventForUpdate)
        {
            if (eventForUpdate == null)
            {
                throw new ArgumentNullException("eventForUpdate");
            }

            return(_writer.WriteEventsToExcel(Events));
        }
Пример #5
0
        public virtual bool UpdateEvent(EventModelBase myEvent)
        {
            if (myEvent == null)
            {
                throw new ArgumentNullException("myEvent");
            }

            _connection.UpdateEvent(myEvent);

            return(true);
        }
Пример #6
0
        public bool AddEvent(EventModelBase eventForAdding)
        {
            if (eventForAdding == null)
            {
                throw new ArgumentNullException("eventForAdding");
            }

            Events.Add(eventForAdding);

            return(_writer.WriteEventsToExcel(Events));
        }
Пример #7
0
        public virtual bool AddEvent(EventModelBase myEvent)
        {
            if (myEvent == null)
            {
                throw new ArgumentNullException("myEvent");
            }

            bool result = _connection.AddEvent(myEvent);

            OnChangingEvents();

            return(result);
        }
Пример #8
0
        public bool RemoveEvent(EventModelBase eventForRemoving)
        {
            if (eventForRemoving == null)
            {
                throw new ArgumentNullException("eventForRemoving");
            }

            if (Events.Contains(eventForRemoving))
            {
                Events.Remove(eventForRemoving);
                return(_writer.WriteEventsToExcel(Events));
            }

            return(false);
        }
Пример #9
0
        public bool RemoveEvent(EventModelBase eventForRemoving)
        {
            if (eventForRemoving == null)
            {
                throw new ArgumentNullException("eventForRemoving");
            }
            if (_events == null)
            {
                throw new InvalidOperationException("_events is null");
            }

            if (_events.Contains(eventForRemoving))
            {
                _events.Remove(eventForRemoving);
            }

            _writer.WriteAllEventsToBd(Events);

            return(true);
        }
Пример #10
0
        private void selectionChangedExecute(SelectionChangedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (e.AddedItems.Count != 0)
            {
                EventModelBase myEvent = e.AddedItems[0] as EventModelBase;
                _bridge.CurrentEvent = myEvent;
            }
            else
            {
                _bridge.CurrentEvent = new SimpleEventModel("No Event is selected", "", DateTime.Now);

                // если вызвать команду "”далить" или "—охранить",
                // то на данном событие оно не сработает, пометили как бы виртуальное.
                _bridge.CurrentEvent.ID = -1;
            }
        }
Пример #11
0
        private void OnChangingEvent(EventModelBase myEvent)
        {
            if (myEvent == null)
            {
                throw new ArgumentNullException("myEvent");
            }

            Name        = myEvent.Name;
            Description = myEvent.Description;
            DatePlanned = myEvent.DatePlanned;
            DateCreated = myEvent.DateCreated;

            if (myEvent.Name == "No Event is selected")
            {
                flafVirtualEvent = false;
            }
            else
            {
                flafVirtualEvent = true;
            }

            RaisePropertyChanged("EventSelected");
            RaisePropertyChanged("EventIsNotSelected");
        }
Пример #12
0
 public void Replay(EventModelBase model)
 {
     _onReplay.Invoke(model);
 }
Пример #13
0
 public bool UpdateEvent(EventModelBase eventForUpdate)
 {
     _writer.WriteAllEventsToBd(Events);
     return(true);
 }