Example #1
0
        /// <summary>
        ///     Creates an instance of <see cref="ApplicationRuntimeModeViewModel" />
        /// </summary>
        /// <param name="interactionService">
        ///     An instance of <see cref="IInteractionService" /> to use
        /// </param>
        /// <param name="configService">
        ///     An instance of <see cref="IRuntimeModeDevicesServices" /> to use
        /// </param>
        /// <param name="settings">Сервис с настойками программы</param>
        public ApplicationRuntimeModeViewModel(IInteractionService interactionService,
                                               IRuntimeModeDevicesServices configService, IApplicationSettingsService settings, CityWideCommandsLogger cityWideCommandsLogger, IApplicationLogViewModel applicationLogViewModel, IDeviceCommandFactory deviceCommandFactory, IDeviceCommandService deviceCommandService)
        {
            Guard.AgainstNullReference(interactionService, "interactionService");
            Guard.AgainstNullReference(configService, "configService");
            Guard.AgainstNullReference(settings, "settings");

            this._interactionService = interactionService;
            this._configService      = configService;
            this._settings           = settings;
            _cityWideCommandsLogger  = cityWideCommandsLogger;
            _applicationLogViewModel = applicationLogViewModel;
            _deviceCommandFactory    = deviceCommandFactory;
            _deviceCommandService    = deviceCommandService;

            try
            {
                if (!File.Exists(String.Format("./nlog_{0}_{1}.txt", DateTime.Now.Month.ToString("D2"), DateTime.Now.Year.ToString("D4"))))
                {
                    using (File.Create(String.Format("./nlog_{0}_{1}.txt", DateTime.Now.Month.ToString("D2"), DateTime.Now.Year.ToString("D4")))) { }
                }
            }
            catch (Exception)
            { }
            this._logger = LogManager.GetLogger("Общие");
        }
Example #2
0
        /// <summary>
        ///     Create a instance of <see cref="SchemeModeRuntimeViewModel"/>
        /// </summary>
        public SchemeModeRuntimeViewModel(IInteractionService interactionService,
                                          IPersistanceService persistanceService, IRuntimeModeDevicesServices devicesServices,
                                          IRuntimeModeDriversService driversService, IDeviceCommandQueueViewModel deviceCommandQueueViewModel,
                                          IDataLoadingService dataLoadingService, IGlobalDefectAcknowledgingService globalDefectAcknowledgingService,
                                          ILogInteractionViewModel logInteractionViewModel,
                                          IOutgoingLinesViewModelFactory outgoingLinesViewModelFactory, IAnalogMeterViewModelFactory analogMeterViewModelFactory, IUnityContainer container)
        {
            Guard.AgainstNullReference(interactionService, "interactionService");
            Guard.AgainstNullReference(persistanceService, "persistanceService");
            Guard.AgainstNullReference(devicesServices, "devicesServices");
            Guard.AgainstNullReference(driversService, "driversService");
            this._interactionService          = interactionService;
            this._persistanceService          = persistanceService;
            this._devicesServices             = devicesServices;
            this._driversService              = driversService;
            _dataLoadingService               = dataLoadingService;
            _globalDefectAcknowledgingService = globalDefectAcknowledgingService;
            _logInteractionViewModel          = logInteractionViewModel;
            _outgoingLinesViewModelFactory    = outgoingLinesViewModelFactory;
            _analogMeterViewModelFactory      = analogMeterViewModelFactory;
            _container = container;
            DeviceCommandQueueViewModel = deviceCommandQueueViewModel;

            this.BusLinkVisibleCollection = new ObservableCollection <bool>(new List <bool> {
                false, false, false
            });

            this.Starter1ToResistorsLink = new ObservableCollection <bool>(new List <bool>(8))
            {
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false
            };
            this.Starter2ToResistorsLink =
                new ObservableCollection <bool>(new List <bool>(8)
            {
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false
            });
            this.Starter3ToResistorsLink =
                new ObservableCollection <bool>(new List <bool>(8)
            {
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false,
                false
            });
            this._linksCollections    = new ObservableCollection <bool> [3];
            this._linksCollections[0] = Starter1ToResistorsLink;
            this._linksCollections[1] = Starter2ToResistorsLink;
            this._linksCollections[2] = Starter3ToResistorsLink;

            OpenPicon2ModuleInformationCommand = new DelegateCommand(OnOpenPicon2ModuleInformationExecute);
        }