I assume you are using a PCL solution.
. - , , , - .
XLabs, .
, , PCL, Android iOS, , , - :
public List<string> Uris;
private ObservableCollection<MediaFile> _images;
public ObservableCollection<MediaFile> Images {
get { return _images ?? (_images = new ObservableCollection< MediaFile >()); }
set {
if(_images != value) {
_images = value;
OnPropertyChanged();
}
}
}
public async Task<string> PickPictureAsync() {
MediaFile file = null;
string filePath = string.Empty;
string imageName = string.Empty;
try {
file = await CrossMedia.Current.PickPhotoAsync();
#region Null Check
if(file == null) { return null; }
#endregion
imageName = "SomeImageName.jpg";
filePath =
} catch(Exception ex) {
Debug.WriteLine("\nIn PictureViewModel.PickPictureAsync() - Exception:\n{0}\n", ex);
return null;
} finally { if(file != null) { file.Dispose(); } }
Receipts.Add(ImageSource.FromFile(filePath));
Uris.Add(filePath);
return imageName;
}