Esempio n. 1
0
        public MushroomDetailPage(MushroomDetailViewModel model) : this()
        {
            BindingContext = model;

            var licenseWeb = new HtmlWebViewSource
            {
                Html = model.Mushroom.ImageLicense
            };

            licenseWebView.Source      = licenseWeb;
            licenseWebView.Navigating += (s, e) =>
            {
                if (e.Url.StartsWith("http"))
                {
                    try
                    {
                        var uri = new Uri(e.Url);
                        Device.OpenUri(uri);
                    }
                    catch (Exception)
                    {
                    }

                    e.Cancel = true;
                }
            };
        }
Esempio n. 2
0
 async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
 {
     var vm = new MushroomDetailViewModel(new MushroomDisplayModel(((HistoryItemDisplayModel)e.Item).Mushroom));
     await Navigation.PushAsync(new MushroomDetailPage(vm));
 }
Esempio n. 3
0
        //TODO: move this to VM using behaviours. https://anthonysimmon.com/eventtocommand-in-xamarin-forms-apps/
        private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var model = new MushroomDetailViewModel(((Prediction)e.Item).Mushroom);

            Navigation.PushAsync(new MushroomDetailPage(model));
        }