Beispiel #1
0
        /// <summary>
        /// 初始化配置中心
        /// </summary>
        /// <param name="componentService"></param>
        /// <param name="consulServerSetting"></param>
        /// <returns></returns>
        public static IComponentService UseConsulConfiguationCenter(this IComponentService componentService)
        {
            //注册ConsulConfigurationService组件
            componentService.SetDefault <IConfigurationService, ConsulConfigurationService>();

            return(componentService);
        }
		public void LoadItemsCollection(DesignItem item)
		{
			Debug.Assert(item.View is ItemsControl);
			_item=item;
			_componentService=item.Services.Component;
			item.Services.Selection.SelectionChanged+= delegate { PropertyGridView.SelectedItems=item.Services.Selection.SelectedItems;  };
			var control=item.View as ItemsControl;
			if(control!=null){
				TypeMappings.TryGetValue(control.GetType(), out _type);
				if (_type != null) {
					IOutlineNode node = OutlineNode.Create(item);
					Outline.Root = node;
					PropertyGridView.PropertyGrid.SelectedItems = item.Services.Selection.SelectedItems;
				}
				else{
					PropertyGridView.IsEnabled=false;
					Outline.IsEnabled=false;
					AddItem.IsEnabled=false;
					RemoveItem.IsEnabled=false;
					MoveUpItem.IsEnabled=false;
					MoveDownItem.IsEnabled=false;
				}
			}
			
		}
        public void AddComponentServiceMethodLockKey(IComponentService service, string methodName)
        {
            IEnumerable <string> rd;
            IEnumerable <string> wd = service.GetMethodLockKeys(methodName, out rd);

            AddLockKeys(rd, wd);
        }
Beispiel #4
0
        /// <summary>
        /// 初始化服务发现
        /// </summary>
        /// <param name="componentService">componentService</param>
        /// <param name="consulSetting">服务发现配置</param>
        /// <returns></returns>
        public static IComponentService InitializeServiceDiscovery(this IComponentService componentService, MicServerSetting micServerSetting, HealthCheckSetting healthCheckSetting)
        {
            _micServerSetting   = micServerSetting;
            _healthCheckSetting = healthCheckSetting;

            /*
             * 设置健康检查
             */
            var httpCheck = new AgentServiceCheck()
            {
                DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(_healthCheckSetting.DeregisterCriticalServiceAfter), //服务启动多久后注册
                Interval = TimeSpan.FromSeconds(_healthCheckSetting.HeathInterval),                                        //健康检查时间间隔,或者称为心跳间隔
                HTTP     = $"{_healthCheckSetting.HeathUrl}:{_healthCheckSetting.Port}{_healthCheckSetting.CheckPath}",    //健康检查地址
                Timeout  = TimeSpan.FromSeconds(_healthCheckSetting.TimeOut)
            };

            /*
             * 注册微信服信息
             */
            var registration = new AgentServiceRegistration()
            {
                Checks  = new[] { httpCheck },
                ID      = _micServerSetting.Id.ToString(),
                Name    = _micServerSetting.Name,
                Address = _micServerSetting.Url,
                Port    = _micServerSetting.Port,
                Tags    = _micServerSetting.Tags
            };

            _consulClient.Agent.ServiceRegister(registration).Wait();//服务启动时注册,内部实现其实就是使用 Consul API 进行注册(HttpClient发起)

            return(componentService);
        }
 public async Task <Component> CreateComponentAsync(
     [Service] IComponentService service,
     string name,
     [DefaultValue("type Component { text: String! }")] string schema,
     [GraphQLType(typeof(AnyType))] Dictionary <string, object?>?values,
     CancellationToken cancellationToken)
 => await service.CreateAsync(name, schema, values, cancellationToken);
 public HomeController(IProductService IProductService, ICategoryService ICategoryService,
                       IComponentService IComponentService)
 {
     _ICategoryService  = ICategoryService;
     _IProductService   = IProductService;
     _IComponentService = IComponentService;
 }
        public AreaService(
            IComponentService componentService,
            IAutomationService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiService apiService,
            ISettingsService settingsService)
        {
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (automationService == null) throw new ArgumentNullException(nameof(automationService));
            if (systemEventsService == null) throw new ArgumentNullException(nameof(systemEventsService));
            if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService));
            if (apiService == null) throw new ArgumentNullException(nameof(apiService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _componentService = componentService;
            _automationService = automationService;
            _apiService = apiService;
            _settingsService = settingsService;

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.GetAll().Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
Beispiel #8
0
        public static IComponentService UseExceptionless(this IComponentService componentService, ExceptionlessSetting exceptionlessSetting)
        {
            initExceptionless(exceptionlessSetting);

            componentService.RegisterAssembly(typeof(ComponentManagerExtend).Assembly);
            return(componentService);
        }
Beispiel #9
0
 public SelectionEditor(EditorGame editorGame)
 {
     this._editorGame       = editorGame;
     this._componentService = ViewContainer.Resolve <IComponentService>();
     this._componentService.SelectionChanged += this.ComponentService_SelectionChanged;
     this._translateGizmo = new TranslateGizmo(editorGame);
 }
Beispiel #10
0
 public DocumentController(
     IAlfrescoHttpClient alfrescoHttpClient,
     IAuditLogService auditLogService,
     IComponentService componentService,
     IDocumentService documentService,
     IIdentityUser identityUser,
     INodesService nodesService,
     ISpisUmConfiguration spisUmConfiguration,
     ITransactionHistoryService transactionHistory,
     IShipmentsService shipmentsService,
     IValidationService validationService,
     IAlfrescoModelComparer alfrescoModelComparer,
     ITranslateService translateService
     )
 {
     _alfrescoHttpClient    = alfrescoHttpClient;
     _auditLogService       = auditLogService;
     _componentService      = componentService;
     _documentService       = documentService;
     _identityUser          = identityUser;
     _nodesService          = nodesService;
     _shipmentsService      = shipmentsService;
     _spisUmConfiguration   = spisUmConfiguration;
     _transactionHistory    = transactionHistory;
     _validationService     = validationService;
     _alfrescoModelComparer = alfrescoModelComparer;
     _translateService      = translateService;
 }
Beispiel #11
0
        public void LoadItemsCollection(DesignItem item)
        {
            Debug.Assert(item.View is ItemsControl);
            _item             = item;
            _componentService = item.Services.Component;
            item.Services.Selection.SelectionChanged += delegate { PropertyGridView.SelectedItems = item.Services.Selection.SelectedItems; };
            var control = item.View as ItemsControl;

            if (control != null)
            {
                TypeMappings.TryGetValue(control.GetType(), out _type);
                if (_type != null)
                {
                    OutlineNode node = OutlineNode.Create(item);
                    Outline.Root = node;
                    PropertyGridView.PropertyGrid.SelectedItems = item.Services.Selection.SelectedItems;
                }
                else
                {
                    PropertyGridView.IsEnabled = false;
                    Outline.IsEnabled          = false;
                    AddItem.IsEnabled          = false;
                    RemoveItem.IsEnabled       = false;
                    MoveUpItem.IsEnabled       = false;
                    MoveDownItem.IsEnabled     = false;
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// 注册使用阿里云短信组件
        /// </summary>
        /// <param name="IComponentService">IComponentService</param>
        /// <param name="aliSmsSetting">阿里云配置<see cref="Ccshis.Information.Sms.Ali.AliSmsSetting"/></param>
        /// <returns></returns>
        public static IComponentService UseAliSms(this IComponentService componentService)
        {
            componentService.SetDefault <ISmsSender, SmsSender>();

            componentService.RegisterAssembly(typeof(ComponentServiceExtend).Assembly);
            return(componentService);
        }
        public AutomationFactory(
            ISchedulerService schedulerService,
            INotificationService notificationService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IComponentService componentService,
            ISettingsService settingsService,
            IResourceService resourceService)
        {
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (notificationService == null) throw new ArgumentNullException(nameof(notificationService));
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (resourceService == null) throw new ArgumentNullException(nameof(resourceService));

            _schedulerService = schedulerService;
            _notificationService = notificationService;
            _dateTimeService = dateTimeService;
            _daylightService = daylightService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _componentService = componentService;
            _settingsService = settingsService;
            _resourceService = resourceService;
        }
Beispiel #14
0
 public void SetUp()
 {
     componentService = ComponentService.Create();
     componentService
     .UseAutofac()
     .UseCommonComponent();
 }
Beispiel #15
0
 public AiAgent(IComponentService componentService, IProductionManager productionManager, IMovementService movementService, InfanteryMindStateService infanteryMindStateService, IHeatMapService heatMapService)
 {
     ComponentService = componentService;
     ProductionManager = productionManager;
     MovementService = movementService;
     InfanteryMindStateService = infanteryMindStateService;
     HeatMapService = heatMapService;
 }
Beispiel #16
0
        /// <summary>
        /// 使用默认配置中心,生产环境不建议使用该方法,请使用配置中心
        /// </summary>
        /// <param name="componentService"></param>
        /// <param name="defaultPath"></param>
        /// <returns></returns>
        public static IComponentService UseDefaultConfigurationService(this IComponentService componentService, string defaultPath = DefaultConfiguationService.DefaultPath)
        {
            //使用默认配置中心
            componentService.SetDefault <IConfigurationService, DefaultConfiguationService>(new DefaultConfiguationService(defaultPath));


            return(componentService);
        }
Beispiel #17
0
        public ComponentController(IComponentService service, IAdminView view)
        {
            servComponent = service;
            _view         = view;

            _view.AddComponent += _view_AddComponent;
            _view.ShowProject  += _view_ShowProject;
        }
Beispiel #18
0
 public ComponentController(IComponentTypeService componentTypeService, IComponentService componentService, IDonorService donorService, IBranchService branchService, IUserHelper userHelper)
 {
     _componentTypeService = componentTypeService;
     _componentService     = componentService;
     _donorService         = donorService;
     _branchService        = branchService;
     _userHelper           = userHelper;
 }
Beispiel #19
0
        /// <summary>
        /// 使用autofac作为依赖注入组件
        /// </summary>
        /// <param name="componentService"></param>
        /// <returns></returns>
        public static IComponentService UseAutofac(this IComponentService componentService)
        {
            var componentServiceImpl = componentService as ComponentService;

            componentServiceImpl.ComponentsConfiguration.UseAutofac();

            return(componentService);
        }
 public OrdersController(IShoppingCartService cartService, IComponentService
                         componentService, UserManager <Customer> userManager, IOrderCartService orderService)
 {
     this._cartService      = cartService;
     this._componentService = componentService;
     this._userManager      = userManager;
     this._orderService     = orderService;
 }
 public void AddComponentService(IComponentService service)
 {
     if (!p_ComponentServices.Contains(service))
     {
         p_ComponentServices.Add(service);
         service.DataSelector = p_ComponentDatabaseContainer.GetDataSelector(service);
     }
 }
Beispiel #22
0
        public RollerShutterAutomation(
            AutomationId id,
            INotificationService notificationService,
            ISchedulerService schedulerService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IComponentService componentService,
            ISettingsService settingsService,
            IResourceService resourceService)
            : base(id)
        {
            if (notificationService == null)
            {
                throw new ArgumentNullException(nameof(notificationService));
            }
            if (dateTimeService == null)
            {
                throw new ArgumentNullException(nameof(dateTimeService));
            }
            if (daylightService == null)
            {
                throw new ArgumentNullException(nameof(daylightService));
            }
            if (outdoorTemperatureService == null)
            {
                throw new ArgumentNullException(nameof(outdoorTemperatureService));
            }
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (resourceService == null)
            {
                throw new ArgumentNullException(nameof(resourceService));
            }

            _notificationService       = notificationService;
            _dateTimeService           = dateTimeService;
            _daylightService           = daylightService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _componentService          = componentService;
            _settingsService           = settingsService;
            _componentService          = componentService;

            resourceService.RegisterText(
                RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature,
                "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C.");

            settingsService.CreateSettingsMonitor <RollerShutterAutomationSettings>(Id, s => Settings = s);

            // TODO: Consider timer service here.
            schedulerService.RegisterSchedule("RollerShutterAutomation-" + Guid.NewGuid(), TimeSpan.FromMinutes(1), PerformPendingActions);
        }
Beispiel #23
0
 public ComponentObserver(IComponentService componentService, IStore<string,IArtificialIntelligence> aiStore)
 {
     ComponentService = componentService;
     AiStore = aiStore;
     ComponentObservationServices = new List<IComponentObservationService>()
                                        {
                                            new ComponentHitsFieldOfVisionService(),
                                        };
 }
Beispiel #24
0
        public static IComponentService Create()
        {
            var componentService = new ComponentService();

            componentService.ComponentsConfiguration = Configuration.Create();

            SingleInstance = componentService as IComponentService;
            return(SingleInstance);
        }
Beispiel #25
0
        protected ActuatorMonitor(IComponentService componentService)
        {
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }

            _componentService = componentService;
        }
 public ProductionServiceBase(string senderId,IProductionFacilityProvider productionFacilityProvider, IComponentService componentService,IOrientationService orientationService, IEventAgent eventAgent)
 {
     SenderId = senderId;
     ProductionFacilityProvider = productionFacilityProvider;
     ComponentService = componentService;
     OrientationService = orientationService;
     EventAgent = eventAgent;
     ProductionRules = new List<IProductionRule>();
 }
 public BaseController(
     IComponentService componentService,
     IComponentTypeService componentTypeService,
     IEquipmentService equipmentService)
 {
     ComponentService     = componentService;
     ComponentTypeService = componentTypeService;
     EquipmentService     = equipmentService;
 }
 public TestCommands(
     IReactionService reactions,
     IComponentService component,
     DiscordSocketClient client)
 {
     _reactions = reactions;
     _client    = client;
     _component = component;
 }
Beispiel #29
0
        /// <summary>
        /// 使用通用模块
        /// </summary>
        /// <param name="componentService"></param>
        /// <param name="defaultPath"></param>
        /// <returns></returns>
        /// <remarks>
        /// author:catdemon
        /// date:2019-5-21
        /// </remarks>
        public static IComponentService UseCommonComponent(this IComponentService componentService, string defaultPath = DefaultConfiguationService.DefaultPath)
        {
            //文件配置
            componentService.SetDefault <IFileConfigurationService, DefaultConfiguationService>(new DefaultConfiguationService(defaultPath));

            //集群组件
            componentService.SetDefault <IClusterService, ClusterService>();

            return(componentService);
        }
Beispiel #30
0
 public ProductionManager(IComponentService componentService, IProductionFacilityProvider productionFacilityProvider,IOrientationService orientationService, IEventAgent eventAgent, string senderId)
 {
     EventAgent = eventAgent;
     ComponentService = componentService;
     OrientationService = orientationService;
     ProductionServices = new List<IProductionService>() {
                                                             new BarrackProductionService(senderId,productionFacilityProvider,ComponentService,OrientationService,eventAgent),
                                                             new InfanteryProductionService(senderId,productionFacilityProvider,ComponentService,OrientationService,eventAgent)
                                                         };
 }
 public SearchController(IComponentTypeService componentTypeService, IComponentService componentService, IEquipmentTypeService equipmentTypeService, IEquipmentService equipmentService, IStatusTypeService statusTypeService, IRepairPlaceService repairPlaceService, IHistoryService historyService)
 {
     ComponentTypeService = componentTypeService;
     ComponentService     = componentService;
     EquipmentTypeService = equipmentTypeService;
     EquipmentService     = equipmentService;
     StatusTypeService    = statusTypeService;
     RepairPlaceService   = repairPlaceService;
     HistoryService       = historyService;
 }
Beispiel #32
0
        public AboutViewModel(IComponentService componentService, IDialogService dialogService)
        {
            this.Version    = componentService.Version;
            this.Components = componentService.Components.Select(x => new ComponentViewModel(x)).ToArray();

            this.CloseCommand.Subscribe(() =>
            {
                dialogService.IsOpen = false;
            });
        }
Beispiel #33
0
 public ValidationService(IAlfrescoHttpClient alfrescoHttpClient, ISignerService signerService, IPdfService pdfService, IComponentService componentService, ISignerClient signerClient, IIdentityUser identityUser, ISignerConfiguration signerConfiguration)
 {
     _signerService       = signerService;
     _pdfService          = pdfService;
     _componentService    = componentService;
     _signerClient        = signerClient;
     _identityUser        = identityUser;
     _alfrescoHttpClient  = alfrescoHttpClient;
     _signerConfiguration = signerConfiguration;
 }
 public ComponentsController(IComponentService service)
 {
     _componentService = service;
     _mapper           = new MapperConfiguration(cfg =>
     {
         cfg.CreateMap <ComponentDTO, Component>();
         cfg.CreateMap <Component, ComponentDTO>();
     })
                         .CreateMapper();
 }
Beispiel #35
0
        public SynonymService(IComponentService componentService)
        {
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }

            _componentService = componentService;
            _storage          = new SynonymServiceStorage();
        }
Beispiel #36
0
        public MovementService(IComponentService componentService, IEventAgent eventAgent
            , IOrientationService orientationService, InfanteryMindStateService infanteryMindStateService, IHeatMapService heatMapService)
        {
            _componentService = componentService;

            _eventAgent = eventAgent;
            _orientationService = orientationService;
            _infanteryMindStateService =infanteryMindStateService;
            _heatMapService = heatMapService;
            _infanteryMindProcessor = new InfanteryMindProcessor(_orientationService, new PathfindingService(), _eventAgent,_heatMapService);
        }
Beispiel #37
0
 public CustomersController(IAdminUserService users, RoleManager <IdentityRole> roleManager,
                            UserManager <Customer> userManager, IComponentService components, INewsArticleService newsArticles,
                            IOrderService orderService)
 {
     this._users        = users;
     this._roleManager  = roleManager;
     this._userManager  = userManager;
     this._components   = components;
     this._newsArticles = newsArticles;
     this._orderService = orderService;
 }
Beispiel #38
0
        protected ComponentAccessor(
            string componentName,
            IComponentService component,
            ApplicationConfiguration configuration)
        {
            ComponentName = componentName;
            ComponentType = configuration.GetComponentType(componentName);
            this.component = component;

            ConfigurationReduction = new XmlReduction();
        }
        public StatusService(IComponentService componentService, IApiService apiService, ISettingsService settingsService)
        {
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (apiService == null) throw new ArgumentNullException(nameof(apiService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _componentService = componentService;
            _settingsService = settingsService;

            apiService.StatusRequested += ExposeStatus;
        }
        public InfanteryMindStateService(AiEventProcessor aiEventProcessor,IHeatMapService heatMapService, IComponentService componentService)
        {
            _aiEventProcessor = aiEventProcessor;
            _heatMapService = heatMapService;
            _componentService = componentService;

            InfanteryMinds = new ConcurrentMemoryStore<string, InfanteryMind>();
            _aiEventProcessor.OnMoveCompleted += _aiEventProcessor_OnMoveCompleted;

            _aiEventProcessor.OnUnitUnderAttack += _aiEventProcessor_OnUnitUnderAttack;
        }
Beispiel #41
0
        public void UndoRedoInputBindings()
        {
            const string originalXaml = "<TextBlock Text=\"My text\" />";

            DesignItem        textBlock = CreateCanvasContext(originalXaml);
            UndoService       s         = textBlock.Context.Services.GetService <UndoService>();
            IComponentService component = textBlock.Context.Services.Component;

            Assert.IsFalse(s.CanUndo);
            Assert.IsFalse(s.CanRedo);

            DesignItemProperty inputbinding = textBlock.Properties["InputBindings"];

            Assert.IsTrue(inputbinding.IsCollection);

            const string expectedXaml = @"<TextBlock Text=""My text"">
  <TextBlock.InputBindings>
    <MouseBinding Gesture=""LeftDoubleClick"" Command=""ApplicationCommands.New"" />
  </TextBlock.InputBindings>
</TextBlock>";

            using (ChangeGroup changeGroup = textBlock.Context.OpenGroup("", new[] { textBlock }))
            {
                DesignItem di = component.RegisterComponentForDesigner(new System.Windows.Input.MouseBinding());
                di.Properties["Gesture"].SetValue(System.Windows.Input.MouseAction.LeftDoubleClick);
                di.Properties["Command"].SetValue("ApplicationCommands.New");

                inputbinding.CollectionElements.Add(di);

                changeGroup.Commit();
            }

            Assert.IsTrue(s.CanUndo);
            Assert.IsFalse(s.CanRedo);
            AssertCanvasDesignerOutput(expectedXaml, textBlock.Context);

            inputbinding = textBlock.Properties["InputBindings"];
            Assert.IsTrue(((System.Windows.Input.InputBindingCollection)inputbinding.ValueOnInstance).Count == inputbinding.CollectionElements.Count);

            s.Undo();
            Assert.IsFalse(s.CanUndo);
            Assert.IsTrue(s.CanRedo);
            AssertCanvasDesignerOutput(originalXaml, textBlock.Context);

            s.Redo();
            Assert.IsTrue(s.CanUndo);
            Assert.IsFalse(s.CanRedo);
            AssertCanvasDesignerOutput(expectedXaml, textBlock.Context);

            Assert.IsTrue(((System.Windows.Input.InputBindingCollection)inputbinding.ValueOnInstance).Count == inputbinding.CollectionElements.Count);

            AssertLog("");
        }
 public ArtificialIntelligenceNhu(IEventAgent eventAgent, string id)
     : base(eventAgent, id)
 {
     ComponentService = new ComponentService();
     EventProcessor = new AiEventProcessor(ComponentService);
     OrientationService = new OrientationService(new Vector2(0,0),ComponentService);
     var productionManager = new ProductionManager(ComponentService, new ProductionFacilityProvider(ComponentService), OrientationService,eventAgent, id);
     HeatMapService = new HeatMapService(new HeatPortionCalculationService(),new Vector2(800,800));
     HeatMapService.Initialize();
     InfanteryMindStateService = new InfanteryMindStateService(EventProcessor as AiEventProcessor,HeatMapService,ComponentService);
     var movementService = new MovementService(ComponentService, EventAgent, OrientationService, InfanteryMindStateService,HeatMapService);
     Agent = new AiAgent(ComponentService, productionManager, movementService, InfanteryMindStateService, HeatMapService);
 }
        public void LoadItemsCollection(DesignItemProperty itemProperty)
        {
            _itemProperty = itemProperty;
            _componentService=_itemProperty.DesignItem.Services.Component;
            TypeMappings.TryGetValue(_itemProperty.ReturnType, out _type);

            _type = _type ?? GetItemsSourceType(_itemProperty.ReturnType);

            if (_type == null) {
                AddItem.IsEnabled=false;
            }

            ListBox.ItemsSource = _itemProperty.CollectionElements;
        }
		public void LoadItemsCollection(DesignItemProperty itemProperty)
		{
			_itemProperty = itemProperty;
			_componentService=_itemProperty.DesignItem.Services.Component;
			TypeMappings.TryGetValue(_itemProperty.ReturnType, out _type);
			if (_type == null) {
				PropertyGridView.IsEnabled=false;
				ListBox.IsEnabled=false;
				AddItem.IsEnabled=false;
				RemoveItem.IsEnabled=false;
				MoveUpItem.IsEnabled=false;
				MoveDownItem.IsEnabled=false;
			}
			
			ListBox.ItemsSource = _itemProperty.CollectionElements;
		}
Beispiel #45
0
        public virtual void Initialize()
        {
            GameTime = new GameTime();

            GameBoard = new GameBoard(800, 800);
            ComponentService = new ComponentService();
            AiStore = new ConcurrentMemoryStore<string, IArtificialIntelligence>();
            MoveUnitService = new MoveUnitService(ComponentService,AiStore);

            Agent = new Agent(new EventValidationService(GameBoard, ComponentService), ComponentService, MoveUnitService, AiStore, GameTime);

            Agent.Register<ArtificialIntelligenceSpa>();
            Agent.Register<ArtificialIntelligenceNku>();
            Agent.Register<ArtificialIntelligenceNhu>();
            Agent.Register<ArtificialIntelligenceJfi>();

            GameMaster = new GameMaster(Agent, GameBoard);
        }
        public PersonalAgentService(
            SynonymService synonymService,
            IComponentService componentService,
            IAreaService areaService,
            IWeatherService weatherService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService)
        {
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (weatherService == null) throw new ArgumentNullException(nameof(weatherService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService));

            _synonymService = synonymService;
            _componentService = componentService;
            _areaService = areaService;
            _weatherService = weatherService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService = outdoorHumidityService;
        }
        public RollerShutterAutomation(
            AutomationId id, 
            INotificationService notificationService,
            ISchedulerService schedulerService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IComponentService componentService,
            ISettingsService settingsService,
            IResourceService resourceService)
            : base(id)
        {
            if (notificationService == null) throw new ArgumentNullException(nameof(notificationService));
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (resourceService == null) throw new ArgumentNullException(nameof(resourceService));

            _notificationService = notificationService;
            _dateTimeService = dateTimeService;
            _daylightService = daylightService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _componentService = componentService;
            _settingsService = settingsService;
            _componentService = componentService;

            resourceService.RegisterText(
                RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature,
                "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C.");

            settingsService.CreateSettingsMonitor<RollerShutterAutomationSettings>(Id, s => Settings = s);

            // TODO: Consider timer service here.
            schedulerService.RegisterSchedule("RollerShutterAutomation-" + Guid.NewGuid(), TimeSpan.FromMinutes(1), PerformPendingActions);
        }
 public NoBarracksAvailableRule(IComponentService componentService)
 {
     _componentService = componentService;
 }
 public ComponentController(IComponentService service) { this.service = service; }
 public LessThandNeededInfanteryRule(IComponentService componentService)
 {
     _componentService = componentService;
 }
        protected ActuatorMonitor(IComponentService componentService)
        {
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));

            _componentService = componentService;
        }
 public BarrackProductionService(string senderId, IProductionFacilityProvider productionFacilityProvider, IComponentService componentService, IOrientationService orientationService, IEventAgent eventAgent)
     : base(senderId, productionFacilityProvider, componentService, orientationService, eventAgent)
 {
     ProductionRules = new List<IProductionRule>() { new NoBarracksAvailableRule(ComponentService) };
 }
 public InfanteryProductionService(string senderId, IProductionFacilityProvider productionFacilityProvider, IComponentService componentService, IOrientationService orientationService, IEventAgent eventAgent)
     : base(senderId, productionFacilityProvider, componentService, orientationService, eventAgent)
 {
     ProductionRules = new List<IProductionRule>() { new BarrackAvailableRule(ComponentService), new LessThandNeededInfanteryRule(ComponentService) };
 }
 public BarrackAvailableRule(IComponentService componentService)
 {
     ComponentService = componentService;
 }
Beispiel #55
0
 public MoveUnitService(IComponentService componentService, IStore<string,IArtificialIntelligence> aiStore)
 {
     AiStore = aiStore;
     ComponentService = componentService;
     MoveUnitStore = new ConcurrentMemoryStore<string, MoveUnitProxy>();
 }