Пример #1
0
        private void ConfigureControllers(Application application)
        {
            Type localClass = application.GetType();

            deviceController = new DeviceController();

            Debug.WriteLine("## AppName: " + deviceController.AppName);
            Debug.WriteLine("## Version: " + deviceController.Version);

            foreach (object attribute in localClass.GetCustomAttributes(true))
            {
                if (attribute is MposConfig)
                {
                    MposConfig appConfig = (MposConfig)attribute;
                    Debug.WriteLine(appConfig);

                    if (appConfig.DeviceDetails)
                    {
                        deviceController.CollectDeviceConfig();
                    }
                    if (appConfig.LocationCollect)
                    {
                        deviceController.CollectLocation();
                    }

                    if (appConfig.EndpointSecondary == null && !appConfig.DiscoveryCloudlet)
                    {
                        throw new NetworkException("You must define an internet server IP or allow the service discovery!");
                    }

                    profileController  = new ProfileController(appConfig.Profile);
                    endpointController = new EndpointController(appConfig.EndpointSecondary, appConfig.DecisionMakerActive, appConfig.DiscoveryCloudlet);

                    break;
                }
            }
        }