Exemple #1
0
        private async void searchResultList_PositionChanged(object sender, EventArgs e)
        {
            ViewportControl viewport = sender as ViewportControl;

            if (viewport.Viewport.Bottom >= viewport.Bounds.Bottom && MainPage._isEventsLoaded &&
                viewport.ManipulationState == System.Windows.Controls.Primitives.ManipulationState.Animating)
            {
                searchResultList.ListFooterTemplate = (DataTemplate)Application.Current.Resources["EventsFooterTemplate"];

                ObservableCollection <EventsResult> res = MainPage.data.EventsData.result;
                string     baseUrl   = EmsApi.getBaseUrl("events", "v1", "search", EmsApi.GetClubIds(), SearchQuery, "", SearchData.result.Count);
                EventsData oldEvents = await EmsApi.getRawResponseAs <EventsData>(baseUrl);

                EmsApi.prettyDisplayDates(oldEvents.result);

                //Appending...
                foreach (EventsResult oldResult in oldEvents.result)
                {
                    SearchData.result.Add(oldResult);
                }

                if (oldEvents == null || oldEvents.result.Count < 10)
                {
                    searchResultList.ListFooterTemplate = (DataTemplate)Application.Current.Resources["ReachedLastSearchEventFooterTemplate"];
                }
                else
                {
                    searchResultList.ListHeaderTemplate = null;
                }
            }
        }
Exemple #2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            searchResultList.ListFooterTemplate = null;

            string clubIds = EmsApi.GetClubIds();

            SearchQuery = textToBeSearched.Text.ToString();

            AddInfoTemplate("EventsFooterTemplate");

            string     url = EmsApi.getBaseUrl("events", "v1", "search", "", SearchQuery, "", 0, "", "", MainPage.EmsLanguage);
            EventsData res = await EmsApi.getRawResponseAs <EventsData>(url);

            if (res == null || res.result == null || res.result.Count == 0)
            {
                AddInfoTemplate("NoSearchEventFooterTemplate");
                return;
            }

            EmsApi.prettyDisplayDates(res.result);

            AddInfoTemplate("ListTemplate", true, res.result);

            //To reach it from details page.
            SearchData = res;
        }
Exemple #3
0
        public static EventsData GetCalendarData()
        {
            EventsData newData = new EventsData()
            {
                info = new Info(), result = new ObservableCollection <EventsResult>()
            };
            string rawApiResponse;
            string withKey        = EventsData.calendarDataKey;
            bool   inPhoneMemmory = IsolatedStorageSettings.ApplicationSettings.TryGetValue <string>(withKey, out rawApiResponse);

            return(inPhoneMemmory ? JsonConvert.DeserializeObject <EventsData>(rawApiResponse) : newData);
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            searchResultList.ListFooterTemplate = null;

            string clubIds = EmsApi.GetClubIds();
            SearchQuery = textToBeSearched.Text.ToString();

            AddInfoTemplate("EventsFooterTemplate");

            string url = EmsApi.getBaseUrl("events", "v1", "search", "", SearchQuery, "", 0, "", "", MainPage.EmsLanguage);
            EventsData res = await EmsApi.getRawResponseAs<EventsData>(url);

            if (res == null || res.result == null || res.result.Count == 0)
            {
                AddInfoTemplate("NoSearchEventFooterTemplate");
                return;
            }

            EmsApi.prettyDisplayDates(res.result);

            AddInfoTemplate("ListTemplate", true, res.result);

            //To reach it from details page.
            SearchData = res;
        }
Exemple #5
0
        private async void EventList_PositionChanged(object sender, EventArgs e)
        {
            ViewportControl viewport = sender as ViewportControl;

            if (MainPage._isEventsLoaded && viewport.ManipulationState == System.Windows.Controls.Primitives.ManipulationState.Animating)
            {
                ObservableCollection <EventsResult> res = MainPage.data.EventsData.result;

                if (viewport.Viewport.Bottom >= viewport.Bounds.Bottom)
                {
                    //Loading...
                    EventList.ListFooterTemplate = (DataTemplate)Application.Current.Resources["EventsFooterTemplate"];

                    string     baseUrl         = EmsApi.getBaseUrl("events", "v1", "after", EmsApi.GetClubIds(), "", (res[res.Count - 1] as EventsResult).id, 0, "", "", EmsLanguage);
                    EventsData freshEventsList = await EmsApi.getRawResponseAs <EventsData>(baseUrl);

                    EmsApi.prettyDisplayDates(freshEventsList.result);

                    //Appending...
                    foreach (EventsResult item in freshEventsList.result)
                    {
                        MainPage.data.EventsData.result.Add(item);
                    }

                    //Displaying the footer acording to data obtained.
                    if (freshEventsList == null || freshEventsList.result.Count < 10)
                    {
                        EventList.ListFooterTemplate = (DataTemplate)Application.Current.Resources["ReachedLastEventFooterTemplate"];
                    }
                    else
                    {
                        EventList.ListHeaderTemplate = null;
                    }
                }

                if (viewport.Viewport.Top <= viewport.Bounds.Top)
                {
                    //Loading...
                    EventList.ListHeaderTemplate = (DataTemplate)Application.Current.Resources["EventsHeaderTemplate"];

                    string     baseUrl   = EmsApi.getBaseUrl("events", "v1", "before", EmsApi.GetClubIds(), "", (res[0] as EventsResult).id, 0, "", "", EmsLanguage);
                    EventsData oldEvents = await EmsApi.getRawResponseAs <EventsData>(baseUrl);

                    EmsApi.prettyDisplayDates(oldEvents.result);

                    //Appending to the top of the list...
                    foreach (EventsResult oldResult in oldEvents.result)
                    {
                        MainPage.data.EventsData.result.Insert(0, oldResult);
                    }

                    //Displaying the header acording to data obtained.
                    if (oldEvents == null || oldEvents.result.Count < 10)
                    {
                        EventList.ListHeaderTemplate = (DataTemplate)Application.Current.Resources["ReachedFirstEventHeaderTemplate"];
                    }
                    else
                    {
                        EventList.ListHeaderTemplate = null;
                    }
                }
            }
        }