예제 #1
0
        public ActionResult Configuration()
        {
            CameraPropertiesModel propertiesModel = new CameraPropertiesModel
            {
                BusModel = new BusModel()
            };
            var allBuses = BusHelpers.GetAllAvailableBuses();

            if (allBuses != null)
            {
                propertiesModel.BusModel.Buses = allBuses
                                                 .Select(bus => new SelectListItem {
                    Text = bus.Name, Value = bus.Id
                });
            }
            else
            {
                propertiesModel.BusModel.Buses = Enumerable.Empty <SelectListItem>();
            }
            (propertiesModel.ApiKey, propertiesModel.ApiSecret, propertiesModel.FacesetToken) = GetApiDetailsFromConfig();
            (propertiesModel.PostalCode,
             propertiesModel.HouseNumber,
             propertiesModel.StreetName,
             propertiesModel.CityName,
             propertiesModel.CountryName,
             propertiesModel.BusId,
             propertiesModel.IsBus)      = GetCameraDetailsFromConfig();
            propertiesModel.IsProcessing = MJPEGStreamManager.Processor.IsProcessing;
            return(View(propertiesModel));
        }
예제 #2
0
        public ActionResult ChangeProperties(CameraPropertiesModel properties)
        {
            processingService.Processor.UpdateProperties(properties);
            processingService.Processor.UpdateKeys(new FaceAnalysis.ApiKeySet(properties.ApiKey, properties.ApiSecret, properties.FacesetToken));
            Properties.Settings.Default.ApiKey       = properties.ApiKey;
            Properties.Settings.Default.ApiSecret    = properties.ApiSecret;
            Properties.Settings.Default.FacesetToken = properties.FacesetToken;
            Properties.Settings.Default.PostCode     = properties.PostalCode;
            Properties.Settings.Default.HouseNo      = properties.HouseNumber;
            Properties.Settings.Default.Street       = properties.StreetName;
            Properties.Settings.Default.City         = properties.CityName;
            Properties.Settings.Default.Country      = properties.CountryName;

            Properties.Settings.Default.Save();
            Properties.Settings.Default.Reload();

            return(RedirectToAction("Configuration"));
        }
예제 #3
0
        public ActionResult ChangeProperties(CameraPropertiesModel properties)
        {
            MJPEGStreamManager.Processor.UpdateProperties(properties);
            MJPEGStreamManager.Processor.UpdateKeys(new FaceAnalysis.ApiKeySet(properties.ApiKey, properties.ApiSecret, properties.FacesetToken));
            Configuration config = WebConfigurationManager.OpenWebConfiguration("~");

            config.AppSettings.Settings["ApiKey"].Value       = properties.ApiKey;
            config.AppSettings.Settings["ApiSecret"].Value    = properties.ApiSecret;
            config.AppSettings.Settings["FacesetToken"].Value = properties.FacesetToken;
            config.AppSettings.Settings["PostCode"].Value     = properties.PostalCode;
            config.AppSettings.Settings["HouseNo"].Value      = properties.HouseNumber;
            config.AppSettings.Settings["Street"].Value       = properties.StreetName;
            config.AppSettings.Settings["City"].Value         = properties.CityName;
            config.AppSettings.Settings["Country"].Value      = properties.CountryName;

            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
            return(RedirectToAction("Configuration"));
        }