public async Task <PickResult <T> > PickSingleObjectAsync <T>(string pageKey, object parameter = null, PickerOpenOption startOption = null) { Type page; lock (_pages) { var typeKey = typeof(T).FullName; if (!_pages.TryGetValue(typeKey, out var pages)) { throw new ArgumentException( string.Format("Type not found: {0}. Did you forget to call ObjectPickerService.Configure?", typeKey), nameof(typeKey)); } if (!pages.TryGetValue(pageKey, out page)) { throw new ArgumentException( string.Format("Page not found: {0}. Did you forget to call ObjectPickerService.Configure?", pageKey), nameof(pageKey)); } } var picker = new ObjectPicker <T>(); if (startOption != null) { picker.PickerOpenOption = startOption; } var result = await picker.PickSingleObjectAsync(page, parameter); return(result); }
private async Task <ImageSource> CropImage(ImageCropperConfig config) { var startOption = new PickerOpenOption { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, }; var ret = await ViewModelLocator.Current.ObjectPickerService.PickSingleObjectAsync <WriteableBitmap>( typeof(ImageCropperPickerViewModel).FullName, config, startOption); if (!ret.Canceled) { return(ret.Result); } return(null); }