Exemplo n.º 1
0
        public override void LayoutChanged( )
        {
            base.LayoutChanged( );

            ScrollView.Bounds = View.Bounds;

            SearchPage.LayoutChanged(ScrollView.Frame.ToRectF( ));

            // Map
            MapView.Frame = new CGRect(0, 0, ScrollView.Frame.Width, ScrollView.Frame.Height * .40f);

            SearchAddressButton.Frame = new CGRect(0, MapView.Frame.Bottom, ScrollView.Frame.Width, 33);

            // Search Results Banner
            UpdateResultsBanner( );

            // add the seperator to the bottom
            Seperator.Frame = new CGRect(0, SearchResultsPrefix.Frame.Bottom - 1, ScrollView.Bounds.Width, 1);

            // wait to layout the table view until all subviews have been laid out. Fixes an issue where the table gets more height than it should,
            // and the last row doesn't fit on screen.
            GroupFinderTableView.Frame = new CGRect(0, Seperator.Frame.Bottom, ScrollView.Bounds.Width, ScrollView.Bounds.Height - Seperator.Frame.Bottom);
            GroupFinderTableView.ReloadData( );

            BlockerView.SetBounds(ScrollView.Frame.ToRectF( ));
        }
Exemplo n.º 2
0
        void GetAdditionalGroups( )
        {
            if (Searching == false)
            {
                Searching = true;

                BlockerView.Show(delegate
                {
                    GroupFinder.GetGroups(GroupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups,
                                          delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result)
                    {
                        BlockerView.Hide(delegate
                        {
                            Searching = false;

                            if (result)
                            {
                                // increment our index to the next set, or the end of the list, whichever is less
                                // this will ensure when we hit the end of the list, CurrGroupIndex reflects that.
                                CurrGroupIndex += Math.Min(groupEntries.Count, NumRequestedGroups);

                                // add in the new results
                                GroupEntries.AddRange(groupEntries);

                                // update the map
                                UpdateMap(result);

                                // and reload the table
                                GroupFinderTableView.ReloadData( );

                                // since we're only loading additional groups, don't flag the
                                // list as updated. We don't want it to reset to the top.
                                GroupListUpdated = false;
                            }
                        });
                    });
                });
            }
        }
Exemplo n.º 3
0
        void GetInitialGroups(int groupTypeId, string street, string city, string state, string zip)
        {
            if (Searching == false)
            {
                // since this is the first search for the new address, get initial values
                // so that if they leave the page and return, we can re-populate them.
                StreetValue = SearchPage.Street.Text;
                CityValue   = SearchPage.City.Text;
                StateValue  = SearchPage.State.Text;
                ZipValue    = SearchPage.ZipCode.Text;

                Searching = true;

                BlockerView.Show(delegate
                {
                    // set the group index we'll begin with
                    CurrGroupIndex = 0;
                    GroupTypeId    = groupTypeId;

                    // request groups from CurrGroupIndex thru CurrGroupIndex + NumRequestedGroups
                    GroupFinder.GetGroups(groupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups,
                                          delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result)
                    {
                        BlockerView.Hide(delegate
                        {
                            Searching = false;

                            // store the source location
                            SourceLocation = sourceLocation;

                            // take the initial group entries
                            GroupEntries = groupEntries;

                            // update the map
                            UpdateMap(result);

                            // reload the table.
                            GroupFinderTableView.ReloadData( );

                            // flag that our group list was updated so that
                            // on the region updated callback from the map, we
                            // can select the appropriate group
                            GroupListUpdated = true;

                            // and record an analytic for the neighborhood that this location was apart of. This helps us know
                            // which neighborhoods get the most hits.
                            string address = StreetValue + " " + CityValue + ", " + StateValue + ", " + ZipValue;

                            // send an analytic if the request went thru ok
                            if (result)
                            {
                                if (groupEntries.Count > 0)
                                {
                                    // increment our index to the next set, or the final amount available, whichever is less.
                                    // this will ensure when we hit the end of the list, CurrGroupIndex reflects that.
                                    CurrGroupIndex = CurrGroupIndex + Math.Min(groupEntries.Count, NumRequestedGroups);

                                    // record an analytic that they searched
                                    GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.Location, address);
                                    //GroupFinderAnalytic.Instance.Trigger( GroupFinderAnalytic.Neighborhood, groupEntries[ 0 ].NeighborhoodArea );
                                }
                                else
                                {
                                    // record that this address failed
                                    GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.OutOfBounds, address);
                                }
                            }
                        });
                    });
                });
            }
        }