示例#1
0
        public EmpDirList()
        {
            InitializeComponent ();

            //Pull to refresh
            itemListview.IsPullToRefreshEnabled = true;

            itemListview.Refreshing += async (sender, e) => {
                EmployeeDirectoryClient client = new EmployeeDirectoryClient();
                itemListview.ItemsSource = await client.GetAllEmployees();
                itemListview.EndRefresh();
            };

            //Refresh List
            itemListview.BeginRefresh ();

            //Item clicked
            itemListview.ItemSelected += async (sender, e) =>  {
                var selectedData = (Employee)e.SelectedItem;

                //Retrieve geo data
                EmployeeDirectoryClient client = new EmployeeDirectoryClient();
                selectedData.Loc = await client.GetLocation(selectedData.City);

                var nextPage = new EmpDirDetail(selectedData);

                await Navigation.PushAsync(nextPage);
            };
        }
示例#2
0
        public EmpDirList()
        {
            InitializeComponent ();

            //Pull to refresh
            itemListview.IsPullToRefreshEnabled = true;

            itemListview.Refreshing += async (sender, e) => {
                itemListview.ItemsSource = await App.EmpDirClient.AllEmployees();
                itemListview.EndRefresh();
            };

            //Refresh List
            itemListview.BeginRefresh ();

            //Item clicked
            itemListview.ItemSelected += async (sender, e) =>  {

                if (e.SelectedItem != null)
                {
                    var selectedData = (Employee)e.SelectedItem;

                    //Retrieve geo data
                    selectedData.GeoLocation = await App.EmpDirClient.GetGeolocation(selectedData.City);

                    var nextPage = new EmpDirDetail(selectedData);

                    await Navigation.PushAsync(nextPage);

                    itemListview.SelectedItem = null;
                }

            };
        }