示例#1
0
        public ConstantsPageViewModel(INavigationService navigationService,
                                      IConstantsRepositoryService constantsRepository,
                                      IPageDialogService dialogService,
                                      ConstantsPurchasingService purchasingService)
            : base(navigationService)
        {
            Title = "Constants";

            //_constantRepository = constantsRepository;
            _constantRepository = App.Database;
            _purchasingService  = purchasingService;
            _dialogService      = dialogService;

            NavigateToAddCommand  = new DelegateCommand(NavigateToAddExecute);
            NavigateToEditCommand = new DelegateCommand(NavigateToEditExecute, ActionCanExecute);
            NavigateToCalcCommand = new DelegateCommand(NavigateToCalcExecute, ActionCanExecute);
            DeleteCommand         = new DelegateCommand(DeleteExecute, ActionCanExecute);

            MessagingCenter.Subscribe <ConstantsRepositoryServiceFake>(this, "deleted", ConstantDeleted);
        }
示例#2
0
        public EditConstPageViewModel(INavigationService navigationService,
                                      IConstantsRepositoryService repositoryService, IPageDialogService dialogService)
            : base(navigationService)
        {
            _navigationService = navigationService;

            //_repositoryService = repositoryService;
            _repositoryService = App.Database;

            _dialogService = dialogService;

            SaveCommand = new DelegateCommand(SaveExecute);
            //Команды, которые будут валидировать свойства каждый раз, когда пользователь вводит текст
            ValidateNameCommand  = new DelegateCommand(() => ValidateName());
            ValidateValueCommand = new DelegateCommand(() => ValidateValue());

            //создаем экземпляры валидационных свойств
            _value = new ValidatableObject <string>();
            _name  = new ValidatableObject <string>();
            //добавляем валидационные правила
            AddValidations();
        }