コード例 #1
0
        public void ConvertIndexToDateTimeTest(int index, int hour, int minute)
        {
            var systemControlViewModel = new SystemControlViewModel();

            var convertIndexToDateTime = systemControlViewModel.ConvertIndexToDateTime(index);

            var expectedDateTime = new DateTime(1, 1, 1, hour, minute, 0);

            Assert.IsTrue(convertIndexToDateTime == expectedDateTime);
        }
コード例 #2
0
        public ActionResult SystemControl(SystemControlViewModel model)
        {
            _db.SystemModuleStates.Single(sms => sms.ModuleName == "AIR_VENT_INTERVAL").Value   = model.AirVentInterval;
            _db.SystemModuleStates.Single(sms => sms.ModuleName == "FANS_INTERVAL").Value       = model.FansInterval;
            _db.SystemModuleStates.Single(sms => sms.ModuleName == "HYGRO_INTERVAL").Value      = model.HygroInterval;
            _db.SystemModuleStates.Single(sms => sms.ModuleName == "SOIL_MOISTURE_LIMIT").Value = model.SoilMoistureLimit;
            _db.SystemModuleStates.Single(sms => sms.ModuleName == "TEMPERATURE_LIMIT").Value   = model.TemperatureLimit;

            _db.SaveChanges();

            return(View(model));
        }
コード例 #3
0
        public ActionResult SystemControl()
        {
            var model = new SystemControlViewModel();

            model.AirVentInterval   = _db.SystemModuleStates.Single(sms => sms.ModuleName == "AIR_VENT_INTERVAL").Value;
            model.FansInterval      = _db.SystemModuleStates.Single(sms => sms.ModuleName == "FANS_INTERVAL").Value;
            model.HygroInterval     = _db.SystemModuleStates.Single(sms => sms.ModuleName == "HYGRO_INTERVAL").Value;
            model.SoilMoistureLimit = _db.SystemModuleStates.Single(sms => sms.ModuleName == "SOIL_MOISTURE_LIMIT").Value;
            model.TemperatureLimit  = _db.SystemModuleStates.Single(sms => sms.ModuleName == "TEMPERATURE_LIMIT").Value;


            ViewData["manualFansState"]    = _db.SystemModuleStates.Single(sms => sms.ModuleName == "MANUAL_FANS").ModuleState;
            ViewData["manualHygrosState"]  = _db.SystemModuleStates.Single(sms => sms.ModuleName == "MANUAL_HYGROS").ModuleState;
            ViewData["manualAirVentState"] = _db.SystemModuleStates.Single(sms => sms.ModuleName == "MANUAL_AIR_VENT").ModuleState;

            return(View(model));
        }
コード例 #4
0
        public OldLookViewModel(IUserInterfaceRoot userInterfaceRoot, IWindowSystem windowSystem,
                                ICommandSenderHost commanSenderHost, ITargetAddressHost targetAddressHost,
                                INotifySendingEnabled notifySendingEnabled, ILinkContol linkContol, ILogger logger,
                                IMultiLoggerWithStackTrace <int> debugLogger, ICycleThreadHolder cycleThreadHolder, IAinsCounter ainsCounter,
                                IParameterLogger parameterLogger, IAinSettingsStorage ainSettingsStorage,
                                IAinSettingsStorageUpdatedNotify storageUpdatedNotify)
        {
            _ainSettingsStorage   = ainSettingsStorage;
            _storageUpdatedNotify = storageUpdatedNotify;
            var commonTelemetryVm = new TelemetryCommonViewModel();

            BsEthernetSettingsVm = new BsEthernetSettingsViewModel(commanSenderHost, targetAddressHost,
                                                                   userInterfaceRoot, logger, windowSystem, notifySendingEnabled);
            BsEthernetNominalsVm = new BsEthernetNominalsViewModel(commanSenderHost, targetAddressHost,
                                                                   userInterfaceRoot, logger, windowSystem, notifySendingEnabled);

            SystemControlVm = new SystemControlViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot, logger,
                                                         windowSystem, notifySendingEnabled, linkContol, commonTelemetryVm);

            var ain1TelemetryVm =
                new AinTelemetryViewModel(commonTelemetryVm, 0, commanSenderHost, logger, userInterfaceRoot);
            var ain2TelemetryVm =
                new AinTelemetryViewModel(commonTelemetryVm, 1, commanSenderHost, logger, userInterfaceRoot);
            var ain3TelemetryVm =
                new AinTelemetryViewModel(commonTelemetryVm, 2, commanSenderHost, logger, userInterfaceRoot);

            AinTelemetriesVm = new AinTelemetriesViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot,
                                                           logger, windowSystem, SystemControlVm, commonTelemetryVm, ain1TelemetryVm, ain2TelemetryVm,
                                                           ain3TelemetryVm); // TODO: sending enabled control?

            cycleThreadHolder.RegisterAsCyclePart(ain1TelemetryVm);
            cycleThreadHolder.RegisterAsCyclePart(ain2TelemetryVm);
            cycleThreadHolder.RegisterAsCyclePart(ain3TelemetryVm);
            cycleThreadHolder.RegisterAsCyclePart(AinTelemetriesVm);

            var ain1CommandOnlyVm = new AinCommandAndMinimalCommonTelemetryViewModel(commanSenderHost,
                                                                                     targetAddressHost, userInterfaceRoot, logger, notifySendingEnabled, 0, _ainSettingsStorage,
                                                                                     _storageUpdatedNotify);
            var ain2CommandOnlyVm = new AinCommandAndMinimalCommonTelemetryViewModel(commanSenderHost,
                                                                                     targetAddressHost, userInterfaceRoot, logger, notifySendingEnabled, 1, _ainSettingsStorage,
                                                                                     _storageUpdatedNotify);
            var ain3CommandOnlyVm = new AinCommandAndMinimalCommonTelemetryViewModel(commanSenderHost,
                                                                                     targetAddressHost, userInterfaceRoot, logger, notifySendingEnabled, 2, _ainSettingsStorage,
                                                                                     _storageUpdatedNotify);

            Ain1CommandVm =
                new AinCommandViewModel(ain1CommandOnlyVm, commonTelemetryVm, ain1TelemetryVm, AinTelemetriesVm);
            Ain2CommandVm =
                new AinCommandViewModel(ain2CommandOnlyVm, commonTelemetryVm, ain2TelemetryVm, AinTelemetriesVm);
            Ain3CommandVm =
                new AinCommandViewModel(ain3CommandOnlyVm, commonTelemetryVm, ain3TelemetryVm, AinTelemetriesVm);

            Ain1SettingsVm = new AinSettingsViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot, logger,
                                                      windowSystem, notifySendingEnabled, 0);
            Ain2SettingsVm = new AinSettingsViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot, logger,
                                                      windowSystem, notifySendingEnabled, 1);
            Ain3SettingsVm = new AinSettingsViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot, logger,
                                                      windowSystem, notifySendingEnabled, 2);

            RectifierTelemetriesVm = new RectifierTelemetriesViewModel(commanSenderHost, targetAddressHost,
                                                                       userInterfaceRoot, logger, windowSystem); // TODO: sending enabled control?
            cycleThreadHolder.RegisterAsCyclePart(RectifierTelemetriesVm);

            CoolerTelemetriesVm = new CoolerTelemetriesViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot,
                                                                 logger, debugLogger, windowSystem); // TODO: sending enabled control?

            EngineSettingsVm = new EngineSettingsViewModel(commanSenderHost, targetAddressHost, userInterfaceRoot,
                                                           logger, windowSystem, notifySendingEnabled);
        }