Ejemplo n.º 1
0
        public override void Report(PKSimEvent pkSimEvent, MarkdownTracker tracker, int indentationLevel)
        {
            base.Report(pkSimEvent, tracker, indentationLevel);
            var eventTemplate = _eventGroupRepository.FindByName(pkSimEvent.TemplateName);

            tracker.AddValue(PKSimConstants.UI.Type, _representationInfoRepository.DisplayNameFor(eventTemplate));
            ReportParametersIn(pkSimEvent, tracker, indentationLevel);
        }
Ejemplo n.º 2
0
        private void convertEvent(PKSimEvent pkSimEvent)
        {
            if (pkSimEvent == null)
            {
                return;
            }

            var templateEvent = _eventGroupRepository.FindByName(pkSimEvent.TemplateName);

            updateIsInputStateByNameAndValue(pkSimEvent, templateEvent);
        }
Ejemplo n.º 3
0
        public void EditEvent(PKSimEvent pkSimEvent)
        {
            var template = _eventGroupRepository.FindByName(pkSimEvent.TemplateName);

            _eventDTO = new EventDTO {
                Description = _representationInfoRepository.InfoFor(template).Description, Template = template
            };

            _eventParametersPresenter.EditParameters(pkSimEvent.AllParameters(p => !p.IsNamed(Constants.Parameters.START_TIME)));
            _view.BindTo(_eventDTO);
        }
Ejemplo n.º 4
0
        private void createNonApplicationEvents()
        {
            // group events by the event-building block they are using
            var eventBuildingBlockInfos = (from eventMapping in _simulation.EventProperties.EventMappings
                                           let usedBuildingBlock = _simulation.UsedBuildingBlockByTemplateId(eventMapping.TemplateEventId)
                                                                   let eventBuildingBlock = usedBuildingBlock.BuildingBlock.DowncastTo <PKSimEvent>()
                                                                                            select new { eventBuildingBlock.Id, eventBuildingBlock.TemplateName, eventBuildingBlock.Name })
                                          .Distinct();

            // create event groups for each used event-building block
            foreach (var eventBuildingBlockInfo in eventBuildingBlockInfos)
            {
                // get event group template
                var templateEventGroup = _eventGroupRepository.FindByName(eventBuildingBlockInfo.TemplateName);

                // create new event group
                var eventGroup = _cloneManagerForBuildingBlock.Clone(templateEventGroup);
                eventGroup.Name = eventBuildingBlockInfo.Name;
                eventGroup.RemoveChild(eventGroup.MainSubContainer());

                // get building block and eventgroup-template to be used
                var eventBuildingBlock = _simulation.UsedBuildingBlockById(eventBuildingBlockInfo.Id);
                var eventTemplate      = eventBuildingBlock.BuildingBlock.DowncastTo <PKSimEvent>();

                // set event group parameter
                _parameterSetUpdater.UpdateValuesByName(eventTemplate, eventGroup);

                // create subcontainers (event groups) for all events of the same type
                int eventIndex = 0; //used for naming of event subcontainers only

                foreach (var eventMapping in _simulation.EventProperties.EventMappings.OrderBy(em => em.StartTime.Value))
                {
                    if (!eventMapping.TemplateEventId.Equals(eventBuildingBlock.TemplateId))
                    {
                        continue; //event from different template
                    }
                    // clone main event subcontainer and set its start time
                    var mainSubContainer = _cloneManagerForBuildingBlock.Clone(templateEventGroup.MainSubContainer());

                    eventIndex           += 1;
                    mainSubContainer.Name = $"{eventBuildingBlockInfo.Name}_{eventIndex}";

                    _parameterSetUpdater.UpdateValue(eventMapping.StartTime, mainSubContainer.StartTime());

                    eventGroup.Add(mainSubContainer);
                }

                // update building block ids
                _parameterIdUpdater.UpdateBuildingBlockId(eventGroup, eventTemplate);

                _eventGroupBuildingBlock.Add(eventGroup);
            }
        }
Ejemplo n.º 5
0
 public PKSimEvent Create(string eventName)
 {
     return(Create(_eventGroupRepository.FindByName(eventName)));
 }