コード例 #1
0
 public Rests(RestsModel model, string _Title)
 {
     InitializeComponent();
     rests.Clear();
     foreach (Rest rest in model.route_points)
     {
         rests.Add(rest);
     }
     RestList.ItemsSource = RestView;
     Title.Title          = _Title;
 }
コード例 #2
0
        async void OnItemSelected(object sender, SelectedItemChangedEventArgs args)
        {
            var item = args.SelectedItem as RoutePoint;

            if (item == null)
            {
                return;
            }
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.GetAsync("http://192.168.137.187:1489/api/get_restaurants/" + item.id);

            var _response = await response.Content.ReadAsStringAsync();

            try
            {
                RestsModel restsModel = JsonConvert.DeserializeObject <RestsModel>(_response);
                await Navigation.PushAsync(new Rests(restsModel, item.title));
            }
            catch { }


            // Manually deselect item.
            ItemsListView.SelectedItem = null;
        }