示例#1
0
        public UpdateProcessViewModel(
            INavigationManager navigation,
            UpdateConfiguration configuration,
            IMySQLProvider mySQLProvider,
            IApplicationInfo applicationInfo,
            ParametersService parametersService,
            IInteractiveService interactive,
            IGuiDispatcher guiDispatcher) : base(navigation)
        {
            this.configuration     = configuration ?? throw new ArgumentNullException(nameof(configuration));
            SQLProvider            = mySQLProvider;
            this.applicationInfo   = applicationInfo ?? throw new ArgumentNullException(nameof(applicationInfo));
            this.parametersService = parametersService ?? throw new ArgumentNullException(nameof(parametersService));
            this.interactive       = interactive ?? throw new ArgumentNullException(nameof(interactive));
            this.guiDispatcher     = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));

            FileName = System.IO.Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                "Резервные копии",
                String.Format("{0}{1:yyMMdd-HHmm}.sql", applicationInfo.ProductName, DateTime.Now)
                );

            IsModal = true;

            //FIXME Здесь проверка micro_updates оставлена для совместимости и возможности корректного обновления со старых версий программ. Удаление сделает невозможным начать обновление с установленного микроапдейта.
            dbVersion = this.parametersService.micro_updates != null?this.parametersService.micro_updates(typeof(Version)) : this.parametersService.version(typeof(Version));

            hops  = configuration.GetHopsToLast(dbVersion).ToArray();
            Title = String.Format("Обновление: {0} → {1}",
                                  dbVersion.VersionToShortString(),
                                  hops.Last().Destination.VersionToShortString());
        }
        public UpdateProcessViewModel(
            INavigationManager navigation,
            UpdateConfiguration configuration,
            IMySQLProvider mySQLProvider,
            IApplicationInfo applicationInfo,
            ParametersService parametersService,
            IInteractiveService interactive,
            IGuiDispatcher guiDispatcher) : base(navigation)
        {
            this.configuration     = configuration ?? throw new ArgumentNullException(nameof(configuration));
            SQLProvider            = mySQLProvider;
            this.applicationInfo   = applicationInfo ?? throw new ArgumentNullException(nameof(applicationInfo));
            this.parametersService = parametersService ?? throw new ArgumentNullException(nameof(parametersService));
            this.interactive       = interactive ?? throw new ArgumentNullException(nameof(interactive));
            this.guiDispatcher     = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));

            FileName = System.IO.Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                "Резервные копии",
                String.Format("{0}{1:yyMMdd-HHmm}.sql", applicationInfo.ProductName, DateTime.Now)
                );

            IsModal = true;

            dbVersion = GetCurrentDBVersion();
            hops      = configuration.GetHopsToLast(dbVersion).ToArray();
            Title     = String.Format("Обновление: {0} → {1}",
                                      dbVersion.VersionToShortString(),
                                      hops.Last().Destination.VersionToShortString());
        }
 public UserCreateDbController(INavigationManager navigation, ILifetimeScope autofacScope, IInteractiveService interactive, IGuiDispatcher guiDispatcher)
 {
     this.navigation    = navigation ?? throw new ArgumentNullException(nameof(navigation));
     this.autofacScope  = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope));
     this.interactive   = interactive ?? throw new ArgumentNullException(nameof(interactive));
     this.guiDispatcher = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));
 }
        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();
        }
示例#5
0
 public SQLDBUpdater(UpdateConfiguration configuration, INavigationManager navigation, IGuiDispatcher gui, BaseParameters.ParametersService parametersService, IApplicationInfo applicationInfo, DbConnection connection, MySqlConnectionStringBuilder connectionStringBuilder, IUserService userService, IUnitOfWorkFactory unitOfWorkFactory, IInteractiveMessage interactiveMessage)
 {
     this.configuration           = configuration ?? throw new ArgumentNullException(nameof(configuration));
     this.navigation              = navigation ?? throw new ArgumentNullException(nameof(navigation));
     this.gui                     = gui ?? throw new ArgumentNullException(nameof(gui));
     this.parametersService       = parametersService ?? throw new ArgumentNullException(nameof(parametersService));
     this.connection              = connection ?? throw new ArgumentNullException(nameof(connection));
     this.connectionStringBuilder = connectionStringBuilder ?? throw new ArgumentNullException(nameof(connectionStringBuilder));
     this.userService             = userService ?? throw new ArgumentNullException(nameof(userService));
     this.unitOfWorkFactory       = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
     this.interactiveMessage      = interactiveMessage ?? throw new ArgumentNullException(nameof(interactiveMessage));
 }
示例#6
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();
        }
示例#7
0
        public ReplaceEntityViewModel(IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, ILifetimeScope autofacScope, ReplaceEntity replaceEntity, IGuiDispatcher guiDispatcher, IValidator validator = null) : base(unitOfWorkFactory, navigation, validator)
        {
            Title = "Замена ссылок на объекты";
            this.replaceEntity = replaceEntity ?? throw new ArgumentNullException(nameof(replaceEntity));
            this.guiDispatcher = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher));

            var entryBuilder = new CommonEEVMBuilderFactory(this, UoW, navigation)
            {
                AutofacScope = autofacScope
            };

            SourceEntryViewModel = entryBuilder.ForEntity <ProtectionTools>().MakeByType().Finish();
            TargetEntryViewModel = entryBuilder.ForEntity <ProtectionTools>().MakeByType().Finish();

            SourceEntryViewModel.Changed += SourceEntryViewModel_Changed;
            TargetEntryViewModel.Changed += TargetEntryViewModel_Changed;
        }