public ToDoViewModel(INavigationService navigationService,
                      ICommandResolver commandResolver)
     : base(navigationService)
 {
     CreateToDoCommand = commandResolver.Command(CreateToDo);
     UpdateItemCommand = commandResolver.Command(UpdateItem);
     DeleteItemCommand = commandResolver.Command(DeleteItem);
 }
Beispiel #2
0
        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);
        }
        public CalendarViewModel(
            ICommandResolver commandResolver,
            ToDoCalendarViewModel toDoCalendarViewModel)
        {
            _toDoCalendarViewModel = toDoCalendarViewModel;

            Months                  = new RangeObservableCollection <MonthViewModel>();
            SelectDayCommand        = commandResolver.Command <DateTime>(SelectDay);
            SelectCurrentDayCommand = commandResolver.Command(SelectCurrentDay);
            RefreshListCommand      = commandResolver.Command(Refresh);

            InitializeMonths(DateTime.Now);
        }
Beispiel #4
0
        public UserProfileViewModel(INavigationService navigationService,
                                    IFileSystem fileService,
                                    IMediaService mediaService,
                                    ICommandResolver commandResolver)
            : base(navigationService)
        {
            _fileService  = fileService;
            _mediaService = mediaService;

            ImageContent = new byte[0];

            ChangeUserProfileCommand = commandResolver.Command <PlatformDocument>(ChangeUserProfile);
            UpdateUserCommand        = commandResolver.Command(UpdateUser);
        }
        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);
        }
Beispiel #6
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 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);
        }
Beispiel #8
0
        public ToDoCalendarViewModel(INavigationService navigationService,
                                     ICommandResolver commandResolver)
            : base(navigationService)
        {
            _commandResolver = commandResolver;

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

            RefreshListCommand = commandResolver.Command(RefreshCommandExecute);
            SelectItemCommand  = commandResolver.Command <int>(id => SelectItem(id));

            MessagingCenter.Subscribe <App>(this, ConstantsHelper.UpdateUI, _ =>
            {
                LoadModelsFromDatabase();
            });
        }
        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 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);
        }
        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 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 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());
        }
Beispiel #14
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);
        }
Beispiel #15
0
 public ToDoViewModel(ICommandResolver commandResolver)
 {
     CreateToDoCommand = commandResolver.Command(CreateToDo);
     UpdateItemCommand = commandResolver.Command(UpdateItem);
     DeleteItemCommand = commandResolver.Command(DeleteItem);
 }