예제 #1
0
		public EmpDirList ()
		{
			InitializeComponent ();

			_viewModel = new EmpDirListVm ();
			this.BindingContext = _viewModel;

			//Pull to refresh
			itemListview.IsPullToRefreshEnabled = true;

			//Refresh data from Oracle MCS
			itemListview.Refreshing += async (sender, e) => {
				await _viewModel.AllEmployees();
				itemListview.ItemsSource = _viewModel.EmployeeList;
				itemListview.EndRefresh();
			};
				

			//Refresh List
			itemListview.BeginRefresh ();

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

				if (e.SelectedItem == null) return;

				var selectedData = (Employee)e.SelectedItem;
				var nextPage = new EmpDirDetail(selectedData);

				await Navigation.PushAsync(nextPage);

				((ListView)sender).SelectedItem = null;
			};
				
		}
예제 #2
0
        public EmpDirList()
        {
            InitializeComponent();

            _viewModel          = new EmpDirListVm();
            this.BindingContext = _viewModel;

            //Pull to refresh
            itemListview.IsPullToRefreshEnabled = true;

            //Refresh data from Oracle MCS
            itemListview.Refreshing += async(sender, e) => {
                await _viewModel.AllEmployees();

                itemListview.ItemsSource = _viewModel.EmployeeList;
                itemListview.EndRefresh();
            };


            //Refresh List
            itemListview.BeginRefresh();

            //Item clicked
            itemListview.ItemSelected += async(sender, e) => {
                if (e.SelectedItem == null)
                {
                    return;
                }

                var selectedData = (Employee)e.SelectedItem;
                var nextPage     = new EmpDirDetail(selectedData);

                await Navigation.PushAsync(nextPage);

                ((ListView)sender).SelectedItem = null;
            };
        }