Example #1
0
        public UserProfileViewModel(
            INavigationService navigationService,
            IFileSystem fileService,
            IMediaService mediaService,
            IPlatformDocumentPicker documentPicker,
            ICommandResolver commandResolver)
            : base(navigationService)
        {
            _fileService    = fileService;
            _mediaService   = mediaService;
            _documentPicker = documentPicker;

            ImageContent = new byte[0];

            ChangeUserProfileCommand = commandResolver.AsyncCommand(ChangeUserProfile);
            UpdateUserCommand        = commandResolver.Command(UpdateUser);
        }
        public BirthdayEditViewModel(
            ICommandResolver commandResolver,
            INavigationService navigationService,
            IFileSystem fileService,
            IMediaService mediaService,
            IPlatformDocumentPicker documentPicker)
            : base(navigationService)
        {
            _fileService             = fileService;
            _mediaService            = mediaService;
            SaveBirthdayCommand      = commandResolver.AsyncCommand(SaveBirthday);
            ChangePersonImageCommand = commandResolver.AsyncCommand(ChangePersonImage);
            SelectMonthCommand       = commandResolver.Command <BirthDateViewModel>(SelectMonth);
            SelectDayCommand         = commandResolver.Command <BirthdayDayViewModel>(SelectDay);
            _documentPicker          = documentPicker;

            BirthDateViewModels = new RangeObservableCollection <BirthDateViewModel>();
            InitializeDays();
            SelectedBirthDateViewModel = BirthDateViewModels.ElementAt(0);
        }
        public SettingsViewModel(
            INavigationService navigationService,
            IFileSystem fileService,
            IMediaService mediaService,
            ThemeSwitcher themeSwitcher,
            IThemeService themeService,
            IPlatformDocumentPicker documentPicker,
            ICommandResolver commandResolver)
            : base(navigationService)
        {
            _fileService    = fileService;
            _mediaService   = mediaService;
            _themeService   = themeService;
            _themeSwitcher  = themeSwitcher;
            _documentPicker = documentPicker;

            _savedTheme = (ThemeTypes)Enum.Parse(typeof(ThemeTypes), Settings.ThemeType);

            bool.TryParse(Settings.UsePin, out bool shouldUsePin);
            UsePin = shouldUsePin;

            if ((ThemeTypes)Enum.Parse(typeof(ThemeTypes), Settings.ThemeType) == ThemeTypes.Dark)
            {
                IsDarkTheme = true;
            }

            bool.TryParse(Settings.UsePinBackground, out bool shouldUsePinBackground);
            UsePinPageBackground = shouldUsePinBackground;

            if (UsePinPageBackground)
            {
                PinBackgroundImagePath = Settings.PinBackground;
            }

            SaveSettingsCommand            = commandResolver.Command(SaveSettings);
            OpenPinViewCommand             = commandResolver.AsyncCommand(OpenPinViewAsync);
            ChangePinViewBackgroundCommand = commandResolver.AsyncCommand(ChangePinBackground);
            ResetPinBackgroundCommand      = commandResolver.Command(ResetPinBackground);
        }