Пример #1
0
        public CalcPageViewModel(INavigationService navigationService,
                                 IPageDialogService dialogService,
                                 IBinaryOperationService binaryOperationService,
                                 FormatService formatService,
                                 DedicationService dedicationService,
                                 ConstantsPurchasingService purchasingService)
            : base(navigationService)
        {
            _dialogService     = dialogService;
            _binaryOperation   = binaryOperationService;
            _formatService     = formatService;
            _dedicationService = dedicationService;
            _purchasingService = purchasingService;

            //defaults
            Title            = "Calculator for Life";
            Display          = "0";
            canBackSpace     = true;
            canChangeSign    = true;
            mustClearDisplay = false;

            DecimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            ConstCommand               = new DelegateCommand(ConstCommandExecute);
            OptionsCommand             = new DelegateCommand(OptionsCommandExecute);
            EnterFiguresCommand        = new DelegateCommand <string>(EnterFiguresExecute);
            BackSpaceCommand           = new DelegateCommand(BackSpaceExecute);
            EnterOperatorCommand       = new DelegateCommand <string>(EnterOperatorExecute);
            CalcCommand                = new DelegateCommand(CalcExecute);
            SignCommand                = new DelegateCommand(SignExecute);
            MemoryCommand              = new DelegateCommand <string>(MemoryExecute);
            AddConstantCommand         = new DelegateCommand(AddConstExecute);
            ClearCommand               = new DelegateCommand(ClearExecute);
            NaigateToDedicationCommand = new DelegateCommand(NavigateToDedicationExecute);

            //подписываемся на событие изменения настроек калькулятора, для того чтобы отформатировать Display
            //на основе новых настроек
            MessagingCenter.Subscribe <SettingsPageViewModel>(this, AppConstants.SETTINGS_CHANGED_MESSAGE, (settingsVm) => UpdateDisplayText());
        }
Пример #2
0
 public DedicationPageViewModel(INavigationService navigationService, DedicationService dedicationService)
     : base(navigationService)
 {
     _dedicationService = dedicationService;
 }