コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            employeeDirectory = new EmployeeDirectoryClient(WorklightClient.CreateInstance(this));

            SearchView search   = FindViewById <SearchView> (Resource.Id.searchView1);
            TextView   lblName  = FindViewById <TextView> (Resource.Id.lblName);
            TextView   lblEmail = FindViewById <TextView> (Resource.Id.lblEmail);
            TextView   lblPhone = FindViewById <TextView> (Resource.Id.lblPhone);

            search.QueryTextSubmit += async(object sender, SearchView.QueryTextSubmitEventArgs e) => {
                Employee employeeRecord = await employeeDirectory.FindEmployee(search.Query);

                if (employeeRecord != null)
                {
                    lblName.Text  = employeeRecord.Name;
                    lblEmail.Text = employeeRecord.Email;
                    lblPhone.Text = employeeRecord.Phone;
                }
                else
                {
                    lblName.Text  = "No Record Found";
                    lblEmail.Text = "";
                    lblPhone.Text = "";
                }
            };
        }
コード例 #2
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);
            };
        }
コード例 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            lblName.Text  = "";
            lblEmail.Text = "";
            lblPhone.Text = "";


            //
            // Create instance of MFP client
            //
            employeeDirectory = new EmployeeDirectoryClient(WorklightClient.CreateInstance());

            tbxSearch.ShouldReturn += (textField) => {
                tbxSearch.ResignFirstResponder();
                return(true);
            };

            tbxSearch.Ended += async delegate(object sender, EventArgs e) {
                Employee employeeRecord = await employeeDirectory.FindEmployee(tbxSearch.Text);

                if (employeeRecord != null)
                {
                    lblName.Text  = employeeRecord.Name;
                    lblEmail.Text = employeeRecord.Email;
                    lblPhone.Text = employeeRecord.Phone;
                }
                else
                {
                    lblName.Text  = "No record found";
                    lblEmail.Text = "";
                    lblPhone.Text = "";
                }
            };
        }