Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using Xamarin.Forms;
- namespace EuroMillions
- {
- public partial class DrawnsView : ContentPage
- {
- private APIReader api;
- public DrawnsView ()
- {
- InitializeComponent ();
- Drawns = new ObservableCollection<Drawn> ();
- api = new APIReader ();
- api.getLastDrawnASync ();
- BindingContext = this;
- }
- public ObservableCollection<Drawn> Drawns {
- get;
- set;
- }
- protected override void OnAppearing()
- {
- base.OnAppearing();
- if (Drawns.Count == 0)
- {
- var drawns = api.getDrawns();
- foreach (var drawn in drawns)
- {
- Drawns.Add(drawn);
- }
- }
- }
- private void DrawnsList_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
- {
- if (LastDrawns.SelectedItem == null)
- {
- return;
- }
- LastDrawns.SelectedItem = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement