Пример #1
0
        public static IAlarmSystemSingleEntityConfigurationService <T> GetAlarmSingleEntityConfigurationService <T>()
        {
            AlarmSystemConfigManager man = FakeAlarmServiceFactory.GetAlarmConfigManager();

            man.RemoteDevice = GetFakeAlarmDevice();

            IAlarmSystemSingleEntityConfigurationService <T> service;
            var type = typeof(T);

            if (type == typeof(sconnDevice))
            {
                service = new DeviceConfigService(man) as IAlarmSystemSingleEntityConfigurationService <T>;
            }
            else if (typeof(T) == typeof(sconnGlobalConfig))
            {
                service = new GlobalConfigService(man) as IAlarmSystemSingleEntityConfigurationService <T>;
            }
            else
            {
                service = null;
            }
            if (service != null)
            {
                service.Online = false; //Disable online config sync for testing
            }

            return(service);
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var configService       = new GlobalConfigService();
            var globalConfig        = configService.LoadConfig(Configuration);
            var userSessionsManager = new UserSessionsManager();

            var labelsService    = new LabelSorterService();
            var histogramService = new HistogramSorterService();

            var imageLabelsPath     = Configuration["FilePaths:ImageLabelsPath"];
            var colorHistogramsPath = Configuration["FilePaths:ColorHistogramFiles"];

            var imageLabelsWrapper = new LoadedImageLabelsWrapper(labelsService.ParseLabels(imageLabelsPath));
            var histogramsWrapper  = new LoadedHistogramsWrapper(histogramService.ParseHistograms(colorHistogramsPath));

            services.AddSingleton(globalConfig);
            services.AddSingleton(configService);
            services.AddSingleton(userSessionsManager);
            services.AddSingleton(labelsService);
            services.AddSingleton(histogramService);
            services.AddSingleton(imageLabelsWrapper);
            services.AddSingleton(histogramsWrapper);

            services.AddRazorPages();
        }
Пример #3
0
 public SyncMembersViewModel(ISettings settings)
 {
     _settings = new GlobalConfigService(settings);
     CanClose  = true;
     Title     = ViewModelsTitles.SYNC_MEMBERS;
     Errors    = new Dictionary <string, List <string> >();
     OnStateChanged(ViewModelState.AddNew);
 }
 public AlarmGlobalConfigViewModel(IAlarmConfigManager manager, IRegionManager regionManager)
 {
     Config              = new sconnGlobalConfig();
     this._manager       = (AlarmSystemConfigManager)manager;
     this._provider      = new GlobalConfigService(_manager);
     this._regionManager = regionManager;
     GetData();
 }
 // GET: AlarmSystemView
 public ActionResult Edit(int ServerId)
 {
     try
     {
         var gprovider = new GlobalConfigService(DomainSession.GetAlarmConfigForContextWithDeviceId(this.HttpContext, ServerId));
         AlarmSystemCommunicationEditModel model = new AlarmSystemCommunicationEditModel(gprovider.Get());
         model.ServerId = ServerId;
         return(View(model));
     }
     catch (Exception e)
     {
     }
     return(View());
 }
Пример #6
0
 public ActionResult Index(int ServerId)
 {
     try
     {
         this._provider = new GlobalConfigService(DomainSession.GetAlarmConfigForContextWithDeviceId(this.HttpContext, ServerId));
         AlarmSystemGlobalModel model = new AlarmSystemGlobalModel(this._provider.Get());
         model.ServerId = ServerId;
         return(View(model));
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
     }
     return(View());
 }
 // GET: AlarmSystemMap
 public ActionResult Edit(int ServerId)
 {
     try
     {
         var gprovider                 = new GlobalConfigService(DomainSession.GetAlarmConfigForContextWithDeviceId(this.HttpContext, ServerId));
         var deviceprovider            = new AlarmDevicesConfigService(DomainSession.GetAlarmConfigForContextWithDeviceId(this.HttpContext, ServerId));
         AlarmSystemMapEditModel model = new AlarmSystemMapEditModel(gprovider.Get(), deviceprovider.GetAll());
         model.ServerId = ServerId;
         return(View(model));
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
     }
     return(View());
 }
Пример #8
0
 public PaymentTransViewModel(ILogger logger, ISettings settings)
 {
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     _logger   = logger;
     _settings = new GlobalConfigService(settings);
     CanClose  = true;
     Title     = ViewModelsTitles.PAYMENT_TRANS;
     Errors    = new Dictionary <string, List <string> >();
     Initialize();
 }
Пример #9
0
 public LoanDetailsViewModel(ISettings settings, IEventAggregator eventAggregator, ILogger logger)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     _eventAggregator = eventAggregator;
     _settings        = new GlobalConfigService(settings);
     _logger          = logger;
     _selectedLoanFiredOnInitialzation = true;
     _unitOfWork = new FamilyContext();
     eventAggregator.GetEvent <LoanSelectedEvent>().Subscribe(OnLoanSelected);
     Errors = new Dictionary <string, List <string> >();
     Initialize();
 }
Пример #10
0
 public OptionsViewModel(ISettings settings)
 {
     _settings = new GlobalConfigService(settings);
     Initialize();
 }
 public AlarmGlobalConfigViewModel()
 {
     _name          = "Gcfg";
     this._provider = new GlobalConfigService(_manager);
 }
Пример #12
0
 public AlarmCommConfigViewModel()
 {
     _name          = "Auth";
     this._provider = new GlobalConfigService(Manager);
 }