public ExportSettingsViewModel(ISettingsStore settings, IAnalytics analytics, INavigationService nav, IFileManager fileManager, IActionPresenter actionPresenter) : base(analytics) { _settings = settings; _analytics = analytics; BrowseForCustomSheetsLocation = new Command(async() => { var fileData = await CrossFilePicker.Current.PickFile(); if (fileData == null) { return; // user canceled file picking } var fileName = fileManager.SaveFile(fileData.FileName, fileData.DataArray); settings.SetCustomSheetsLocation(fileName); OnPropertyChanged(nameof(CustomSheetsLocation)); OnPropertyChanged(nameof(HasCustomSheetsLocation)); OnPropertyChanged(nameof(NoCustomSheetsLocation)); }); ChangeCustomSheetsLocation = new Command(() => { actionPresenter.ActionSheet() .With(AppRes.ExportSettings_CustomSheets_Change_Browse, BrowseForCustomSheetsLocation) .With(AppRes.ExportSettings_CustomSheets_Change_Clear, () => { settings.ClearCustomSheetsLocation(); OnPropertyChanged(nameof(CustomSheetsLocation)); OnPropertyChanged(nameof(HasCustomSheetsLocation)); OnPropertyChanged(nameof(NoCustomSheetsLocation)); }) .WithCancel(AppRes.ExportSettings_CustomSheets_Change_Cancel) .Show(AppRes.ExportSettings_CustomSheets_Change_Title); }); Dismiss = new Command(() => nav.DismissModal()); DistanceUnits = new List <PickerOption <LengthUnit> > { new PickerOption <LengthUnit> { DisplayValue = AppRes.Settings_LengthUnit_Meters, Value = LengthUnit.Meter }, new PickerOption <LengthUnit> { DisplayValue = AppRes.Settings_LengthUnit_Miles, Value = LengthUnit.Mile }, }; MassUnits = new List <PickerOption <MassUnit> > { new PickerOption <MassUnit> { DisplayValue = AppRes.Settings_MassUnit_Kilograms, Value = MassUnit.Kilogram }, new PickerOption <MassUnit> { DisplayValue = AppRes.Settings_MassUnit_Pounds, Value = MassUnit.Pound }, }; EnergyUnits = new List <PickerOption <EnergyUnit> > { new PickerOption <EnergyUnit> { DisplayValue = AppRes.Settings_EnergyUnit_Kilocalories, Value = EnergyUnit.Kilocalorie }, new PickerOption <EnergyUnit> { DisplayValue = AppRes.Settings_EnergyUnit_Calories, Value = EnergyUnit.Calorie }, }; DurationUnits = new List <PickerOption <DurationUnit> > { new PickerOption <DurationUnit> { DisplayValue = AppRes.Settings_DurationUnit_Minutes, Value = DurationUnit.Minute }, new PickerOption <DurationUnit> { DisplayValue = AppRes.Settings_DurationUnit_Hours, Value = DurationUnit.Hour }, }; }