public NewToDoViewModel(INavigationService navigationService,
                         ICommandResolver commandResolver)
     : base(navigationService)
 {
     CreateToDoCommand   = commandResolver.AsyncCommand(CreateToDo, () => IsEnabled);
     NavigateBackCommand = commandResolver.AsyncCommand(NavigateBack);
 }
 public GalleryItemViewModel(INavigationService navigationService,
                             ICommandResolver commandResolver)
     : base(navigationService)
 {
     DeleteCommand       = commandResolver.AsyncCommand(Delete);
     NavigateBackCommand = commandResolver.AsyncCommand(NavigateBack);
 }
Exemple #3
0
 public NewAchievementViewModel(INavigationService navigationService,
                                ICommandResolver commandResolver)
     : base(navigationService)
 {
     CreateAchievementCommand = commandResolver.AsyncCommand(CreateAchievement, () => IsEnabled);
     NavigateBackCommand      = commandResolver.AsyncCommand(NavigateBack);
 }
Exemple #4
0
 public AchievementStepViewModel(
     INavigationService navigationService,
     ICommandResolver commandResolver)
     : base(navigationService)
 {
     SaveStepCommand = commandResolver.AsyncCommand(SaveStep, () => { return IsEnabled; });
     NavigateBackCommand = commandResolver.AsyncCommand(NavigateBack);
 }
        public BirthdaysViewModel(
            INavigationService navigationService,
            ICommandResolver commandResolver)
            : base(navigationService)
        {
            Birthdays = new RangeObservableCollection <BirthdayViewModel>();

            RefreshCommand = commandResolver.Command(Refresh);
            NavigateToEditBirthdayCommand = commandResolver.AsyncCommand <int>(EditBirthday);
            DeleteBirthdayCommand         = commandResolver.AsyncCommand <BirthdayViewModel>(DeleteBirthday);
        }
        public AchievementsViewModel(
            INavigationService navigationService,
            ICommandResolver commandResolver)
            : base(navigationService)
        {
            Achievements = new ObservableCollection <AchievementViewModel>();

            RefreshListCommand = commandResolver.Command(Refresh);
            NavigateToAchievementEditViewCommand = commandResolver.AsyncCommand <int>(NavigateToAchievementEditView);
            CreateNewAchievementCommand          = commandResolver.Command(CreateNewAchievement);
            DeleteAchievementCommand             = commandResolver.AsyncCommand <AchievementViewModel>(DeleteAchievement);
        }
Exemple #7
0
        public NotesViewModel(INavigationService navigationService,
                              IUploadService uploadService,
                              ICommandResolver commandResolver)
            : base(navigationService)
        {
            _uploadService = uploadService;
            Notes          = new ObservableCollection <Note>();

            SearchText = string.Empty;

            UploadNotesToApiCommand   = commandResolver.AsyncCommand(UploadAllNotes);
            DeleteNoteCommand         = commandResolver.AsyncCommand <Note>(DeleteNote);
            RefreshListCommand        = commandResolver.Command(Refresh);
            SearchCommand             = commandResolver.Command(SearchNotesByDescription);
            NavigateToEditViewCommand = commandResolver.AsyncCommand <int>(NavigateToEditView);
        }
        public AchievementEditViewModel(INavigationService navigationService,
                                        ICommandResolver commandResolver)
            : base(navigationService)
        {
            _stepsToDelete   = new List <AchievementStep>();
            AchievementSteps = new ObservableCollection <AchievementStep>();

            SaveAchievementCommand = commandResolver.AsyncCommand(SaveAchievement);
            NavigateToAchievementStepEditViewCommand = commandResolver.AsyncCommand <AchievementStep>(NavigateToAchievementStepEditView);
            DeleteAchievementCommand = commandResolver.AsyncCommand(DeleteAchievement);
            AddStepCommand           = commandResolver.AsyncCommand(AddStep);
            DeleteStepCommand        = commandResolver.AsyncCommand <AchievementStep>(DeleteStep);
            ChangeEditEnabledCommand = commandResolver.Command(() => IsEditMode = !IsEditMode);

            MessagingCenter.Subscribe <AchievementStepViewModel>(this, ConstantsHelper.AchievementStepEditComplete, vm => UpdateStepsList());
        }
        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);
        }
Exemple #10
0
        public MenuMasterViewModel(INavigationService navigationService,
                                   ThemeSwitcher themeSwitcher,
                                   ICommandResolver commandResolver)
            : base(navigationService)
        {
            _themeSwitcher = themeSwitcher;

            MessagingCenter.Subscribe <UserProfileViewModel>(this,
                                                             ConstantsHelper.ProfileUpdated,
                                                             vm => UpdateProfile());
            MessagingCenter.Subscribe <ThemeSwitcher>(this,
                                                      ConstantsHelper.AppThemeChanged,
                                                      ts => DrawMenu());

            UpdateProfile();
            DrawMenu();

            NavigateToUserProfileCommand = commandResolver.AsyncCommand(NavigateToUserProfile);
            ChangeDetailsPageCommand     = commandResolver.AsyncCommand <MenuViewIndex>(ChangeDetailsPageAsync);
            LogoutCommand = commandResolver.AsyncCommand(Logout);
        }
        public NoteEditViewModel(INavigationService navigationService,
                                 IPermissionService permissionService,
                                 IFileSystem fileService,
                                 IMediaService mediaService,
                                 IVideoService videoService,
                                 ICommandResolver commandResolver,
                                 MediaHelper mediaHelper,
                                 TransformHelper transformHelper)
            : base(navigationService)
        {
            _permissionService = permissionService;
            _fileService       = fileService;
            _mediaService      = mediaService;
            _videoService      = videoService;
            _commandResolver   = commandResolver;

            _mediaHelper     = mediaHelper;
            _transformHelper = transformHelper;

            AttachButtonImageSource = ConstantsHelper.AttachmentLightIcon;
            CameraButtonImageSource = ConstantsHelper.CameraIcon;
            VideoButtonImageSource  = ConstantsHelper.VideoIcon;

            GalleryItemModels = new RangeObservableCollection <GalleryItemModel>();

            DescriptionTextChanged   = commandResolver.Command <string>(DescriptionChanged);
            TakePhotoCommand         = commandResolver.AsyncCommand(TakePhoto);
            TakeVideoCommand         = commandResolver.AsyncCommand(TakeVideo);
            PickMultipleMediaCommand = commandResolver.AsyncCommand(PickMultipleMedia);
            SaveNoteCommand          = commandResolver.AsyncCommand <string>(SaveNote);
            DeleteNoteCommand        = commandResolver.AsyncCommand(DeleteNote);
            SelectImageCommand       = commandResolver.AsyncCommand <GalleryItemModel>(SelectImage);
        }
        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);
        }
        public LoginViewModel(INavigationService navigationService,
                              ThemeSwitcher themeSwitcher,
                              ICommandResolver commandResolver)
            : base(navigationService)
        {
            TogglePasswordImageSource = themeSwitcher.CurrentThemeType == ThemeTypes.Dark
                        ? ConstantsHelper.TogglePasswordLightImage
                        : ConstantsHelper.TogglePasswordDarkImage;

            SignInCommand = commandResolver.AsyncCommand(SignIn);
            SwitchPasswordVisibilityCommand        = commandResolver.Command(SwitchPasswordVisibility);
            ToggleRegisterOrLoginViewCommand       = commandResolver.Command(ToggleRegisterOrLoginView);
            SwitchPasswordConfirmVisibilityCommand = commandResolver.Command(SwitchConfirmPasswordVisibility);
        }
Exemple #14
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 ToDoCalendarViewModel(
            INavigationService navigationService,
            ICommandResolver commandResolver)
            : base(navigationService)
        {
            _commandResolver        = commandResolver;
            _calendarViewModel      = new CalendarViewModel(commandResolver, this);
            Months                  = CalendarViewModel.Months;
            SelectDayCommand        = CalendarViewModel.SelectDayCommand;
            SelectCurrentDayCommand = CalendarViewModel.SelectCurrentDayCommand;

            AllModels       = new RangeObservableCollection <ToDoViewModel>();
            ActiveModels    = new RangeObservableCollection <ToDoViewModel>();
            CompletedModels = new RangeObservableCollection <ToDoViewModel>();
            FailedModels    = new RangeObservableCollection <ToDoViewModel>();

            CreateToDoCommand       = commandResolver.AsyncCommand(CreateToDo);
            DeleteToDoCommand       = commandResolver.Command <ToDoViewModel>(DeleteToDo);
            ChangeToDoStatusCommand = commandResolver.Command <ToDoViewModel>(ChangeToDoStatus);
        }
Exemple #16
0
        public SettingsViewModel(INavigationService navigationService,
                                 ThemeSwitcher themeSwitcher,
                                 IThemeService themeService,
                                 ICommandResolver commandResolver)
            : base(navigationService)
        {
            _themeService  = themeService;
            _themeSwitcher = themeSwitcher;

            _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;
            }
            SaveSettingsCommand = commandResolver.Command <string>(pin => SaveSettings(pin));
            OpenPinViewCommand  = commandResolver.AsyncCommand(OpenPinViewAsync);
        }