コード例 #1
0
        public IssueByIdentifierViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            INavigationManager navigation,
            IGuiDispatcher guiDispatcher,
            IUserService userService,
            ILifetimeScope autofacScope,
            StockRepository stockRepository,
            EmployeeRepository employeeRepository,
            FeaturesService featuresService,
            IValidator validator,
            BaseParameters baseParameters,
            IInteractiveQuestion interactive,
            IChangeableConfiguration configuration,
            SizeService sizeService,
            ICardReaderService cardReaderService = null) : base(navigation)
        {
            this.unitOfWorkFactory  = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this.guiDispatcher      = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));
            this.userService        = userService ?? throw new ArgumentNullException(nameof(userService));
            this.autofacScope       = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope));
            this.employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            this.validator          = validator ?? throw new ArgumentNullException(nameof(validator));
            this.BaseParameters     = baseParameters ?? throw new ArgumentNullException(nameof(baseParameters));
            this.interactive        = interactive ?? throw new ArgumentNullException(nameof(interactive));
            this.configuration      = configuration ?? throw new ArgumentNullException(nameof(configuration));
            SizeService             = sizeService ?? throw new ArgumentNullException(nameof(sizeService));
            this.cardReaderService  = cardReaderService;
            IsModal = false;
            EnableMinimizeMaximize = true;
            Title = "Выдача по картам СКУД";

            UowOfDialog = unitOfWorkFactory.CreateWithoutRoot();
            var entryBuilder = new CommonEEVMBuilderFactory <IssueByIdentifierViewModel>(this, this, UowOfDialog, navigation, autofacScope);

            if (cardReaderService != null)
            {
                cardReaderService.RefreshDevices();
                cardReaderService.СardStatusRead           += RusGuardService_СardStatusRead;
                cardReaderService.CardFamilies.ListChanged += CardFamilies_ListChanged;
            }
            UpdateState();


            WarehouseEntryViewModel = entryBuilder.ForProperty(x => x.Warehouse).MakeByType().Finish();
            Warehouse = stockRepository.GetDefaultWarehouse(UowOfDialog, featuresService, autofacScope.Resolve <IUserService>().CurrentUserId);

            //Настройка таймера сброса
            timerCleanSuccessfullyText           = new Timer(40000);
            timerCleanSuccessfullyText.AutoReset = false;
            timerCleanSuccessfullyText.Elapsed  += delegate(object sender, ElapsedEventArgs e) {
                guiDispatcher.RunInGuiTread(() => SuccessfullyText = null);
            };

            ReadConfig();
        }
コード例 #2
0
        public ReadCardViewModel(
            INavigationManager navigation,
            ICardReaderService cardReaderService,
            IGuiDispatcher guiDispatcher,
            IChangeableConfiguration configuration) : base(navigation)
        {
            IsModal = true;
            Title   = "Чтение карты";
            this.cardReaderService = cardReaderService ?? throw new ArgumentNullException(nameof(cardReaderService));
            this.guiDispatcher     = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));
            this.configuration     = configuration ?? throw new ArgumentNullException(nameof(configuration));

            StartReading();
        }