Skip to content

Instantly share code, notes, and snippets.

@Char0394
Created June 15, 2017 02:03
Show Gist options
  • Save Char0394/aa728510b391c6742a6dc17a4a48b5f0 to your computer and use it in GitHub Desktop.
Save Char0394/aa728510b391c6742a6dc17a4a48b5f0 to your computer and use it in GitHub Desktop.
public partial class MainPage : ContentPage
{
List<string> _images = new List<string>();
public MainPage()
{
InitializeComponent();
//Remember to remove the temporal files
//DependencyService.Get<IMediaService>().ClearFiles(_images);
}
protected override void OnAppearing()
{
base.OnAppearing();
MessagingCenter.Subscribe<App, List<string>> ((App)Xamarin.Forms.Application.Current, "ImagesSelected", (s, images) =>
{
listItems.FlowItemsSource = images;
_images = images;
});
}
protected override void OnDisappearing()
{
base.OnDisappearing();
MessagingCenter.Unsubscribe<App, List<string>>(this, "ImagesSelected");
}
async void Handle_Clicked(object sender, System.EventArgs e)
{
await DependencyService.Get<IMediaService>().OpenGallery();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment