Exemple #1
0
            public void PerformSearch( )
            {
                // is there something to search?
                if (SearchField.GetCurrentValue( ).Length > Settings.General_MinSearchLength)
                {
                    SearchField.ResignFirstResponder( );

                    // disable the button, reset the results, and show the blocker
                    SearchButton.Enabled = false;

                    ClearResults( );

                    SearchField.ResignFirstResponder( );

                    Parent.BlockerView.BringToFront( );

                    Parent.BlockerView.Show(
                        delegate
                    {
                        // search for the family
                        RockApi.Get_Groups_FamiliesByPersonNameSearch(SearchField.GetCurrentValue( ),
                                                                      delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.Family> model)
                        {
                            // re-enable the search button
                            SearchButton.Enabled = true;

                            // if results came back, populate our list
                            if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0)
                            {
                                foreach (Rock.Client.Family family in model)
                                {
                                    FamilyManagerApi.SortFamilyMembers(family.FamilyMembers);

                                    FamilyResult result = new FamilyResult(this, family);
                                    Results.Add(result);

                                    // tell our parent to re-layout so we position the results
                                    ParentView.SetNeedsLayout( );
                                }
                            }
                            else
                            {
                                // just create a single entry that represents a 'no result' entry
                                FamilyResult result = new FamilyResult(this, null);
                                Results.Add(result);

                                ParentView.SetNeedsLayout( );
                            }

                            Parent.BlockerView.Hide( );
                        });
                    });
                }
            }
        public void PerformSearch( )
        {
            if (SearchField.GetCurrentValue( ).Length > Settings.General_MinSearchLength)
            {
                // put the list at the top, so that when we refresh it, it correctly resizes each row
                TableView.SetContentOffset(CGPoint.Empty, true);

                SearchField.ResignFirstResponder( );

                BlockerView.BringToFront( );

                BlockerView.Show(
                    delegate
                {
                    // search for the family
                    RockApi.Get_Groups_FamiliesByPersonNameSearch(SearchField.GetCurrentValue( ),
                                                                  delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.Family> model)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0)
                        {
                            Families = model;
                        }
                        else
                        {
                            // error (or no results)
                            Families = new List <Rock.Client.Family>( );

                            DidSearchFail = true;
                        }

                        // reload data
                        ((TableSource)TableView.Source).FamiliesUpdated(TableView);
                        TableView.ReloadData( );

                        BlockerView.Hide( );
                    });
                });
            }
        }