Ejemplo n.º 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("Общие");
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 public RuntimeDeviceViewModel(IStarterViewModelFactory starterViewModelFactory,
                               IDefectStateViewModel defectStateViewModel, IDeviceCommandService deviceCommandService,
                               IAnalogDataViewModel analogDataViewModel, IOutgoingLinesViewModelFactory outgoingLinesViewModelFactory,
                               ICustomItemsViewModelFactory customItemsViewModelFactory, ICustomItemsViewModel customItemsViewModel,
                               IQueryIndicatorViewModel queryIndicatorViewModel)
 {
     _starterViewModelFactory       = starterViewModelFactory;
     StarterViewModels              = new ObservableCollection <IStarterViewModel>();
     _defectStateViewModel          = defectStateViewModel;
     _deviceCommandService          = deviceCommandService;
     _outgoingLinesViewModelFactory = outgoingLinesViewModelFactory;
     _customItemsViewModelFactory   = customItemsViewModelFactory;
     AnalogDataViewModel            = analogDataViewModel;
     NavigateToSchemeCommand        = new DelegateCommand(OnNavigateToSchemeExecute);
     StateWidget             = WidgetState.NoConnection;
     _customItemsViewModel   = customItemsViewModel;
     QueryIndicatorViewModel = queryIndicatorViewModel;
 }