void OnSearchClear()
        {
            ExhibitorsWrapper          = AppModel.Instance.ExhibitorsWrapper;
            _groupListView.ItemsSource = ExhibitorsWrapper;

            _listWrapper.ClearSearch();
        }
        public void Search(ExhibitorsDataWrapper dataWrapper, string pattern)
        {
            IsBusy = false;

            IsSearching       = true;
            Pattern           = pattern;
            SearchDataWrapper = dataWrapper;
            OnAction();
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            /*
             *          var searchBarView = new SearchBarView ();
             *          searchBarView.Clear += OnSearchClear;
             *          searchBarView.Search += OnSearch;
             */

            _listWrapper = new ExhibitorsListWrapper();

            ExhibitorsWrapper = AppModel.Instance.ExhibitorsWrapper;

            /*
             * if (ExhibitorsWrapper == null)
             * {
             *  AppModel.Instance.SponsorTypes.UpdateData(LocalData.getLocalSponsorList());
             *  AppModel.Instance.Exhibitors.UpdateData(LocalData.getLocalExhibitorList());
             *  ExhibitorsWrapper = new ExhibitorsDataWrapper(AppModel.Instance.SponsorTypes, AppModel.Instance.Exhibitors, false);
             * }*/
            _groupListView = new ListView {
                HasUnevenRows       = false,
                RowHeight           = 60,
                IsGroupingEnabled   = true,
                GroupHeaderTemplate = new DataTemplate(typeof(ExhibitorGroupItem)),
                SeparatorVisibility = SeparatorVisibility.None,
                ItemTemplate        = new DataTemplate(typeof(ExhibitorViewCell)),

                RefreshCommand         = _listWrapper.RefreshCommand,
                IsPullToRefreshEnabled = true,
                ItemsSource            = ExhibitorsWrapper,
                BindingContext         = _listWrapper
            };
            _groupListView.SetBinding <ExhibitorsListWrapper> (ListView.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);

            var layout = new StackLayout
            {
                Padding  = new Thickness(20),
                Children = { _groupListView }
                //Children = {searchBarView, _groupListView}
            };

            BGLayoutView bgLayout = new BGLayoutView(AppResources.DefaultBgImage, layout, false, true);

            Content = bgLayout;

            _groupListView.BeginRefresh();



            _groupListView.BeginRefresh();
        }
        void OnSearch(string pattern)
        {
            if (_previousPattern.Equals(pattern))
            {
                return;
            }

            _previousPattern           = pattern;
            ExhibitorsWrapper          = new ExhibitorsDataWrapper(AppModel.Instance.SponsorTypes, new DynamicListData <Exhibitor> (), true);
            _groupListView.ItemsSource = ExhibitorsWrapper;

            _listWrapper.Search(ExhibitorsWrapper, pattern);
        }
示例#5
0
        public void LoadAppData()
        {
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 20.ToString() + AppResources.GetLevelImageByPoints (20));
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 120.ToString() + AppResources.GetLevelImageByPoints (120));
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 200.ToString() + AppResources.GetLevelImageByPoints (200));
            //
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 349.ToString() + AppResources.GetLevelImageByPoints (349));
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 580.ToString() + AppResources.GetLevelImageByPoints (580));
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 998.ToString() + AppResources.GetLevelImageByPoints (998));
            //			AppProvider.Log.WriteLine (Conarh_2016.Core.Services.LogChannel.All, "GetPoints " + 1002.ToString() + AppResources.GetLevelImageByPoints (1002));

            AppInformation = DbClient.Instance.GetData <AppInformation>(AppInformation.AppDataId).Result ?? new AppInformation();

            Images = new DynamicListData <ImageData>();
            Images.UpdateData(DbClient.Instance.GetData <ImageData>().Result);

            Speakers = new DynamicListData <Speaker>();
            Speakers.UpdateData(DbClient.Instance.GetData <Speaker>().Result);

            BadgeTypes = new DynamicListData <BadgeType>();
            BadgeTypes.UpdateData(DbClient.Instance.GetData <BadgeType>().Result);

            SponsorTypes = new DynamicListData <SponsorType>();
            SponsorTypes.UpdateData(DbClient.Instance.GetData <SponsorType>().Result);

            /* TODO ARumar o load data */
            SponsorTypes.Items.Clear();

            Users = new DynamicListData <User>();
            Users.UpdateData(DbClient.Instance.GetData <User>().Result);

            Requests = new DynamicListData <ConnectRequest>();
            List <ConnectRequest> requestsData = DbClient.Instance.GetData <ConnectRequest>().Result;

            foreach (ConnectRequest request in requestsData)
            {
                /*
                 *
                 * request.Requester = Users.Find(request.RequesterId);
                 * request.Responder = Users.Find(request.ResponderId);
                 */

                request.RequesterId = request.RequesterId;
                request.ResponderId = request.ResponderId;
            }
            Requests.UpdateData(requestsData);


            /* TODO ARumar o load data */
            Exhibitors = new DynamicListData <Exhibitor>();
            List <Exhibitor> exhibitorData = DbClient.Instance.GetData <Exhibitor>().Result;

            /*
             * foreach (Exhibitor exhibitor in exhibitorData)
             *  exhibitor.SponsorType = SponsorTypes.Find(exhibitor.SponsorTypeId);
             */
            exhibitorData.Clear();
            Exhibitors.UpdateData(exhibitorData);

            PayedEvents = new DynamicListData <EventData>();
            FreeEvents  = new DynamicListData <EventData>();
            List <EventData> eventsData = DbClient.Instance.GetData <EventData>().Result;

            foreach (EventData evData in eventsData)
            {
                evData.Speechers = new List <Speaker>();
                List <string> speakersIds = JsonConvert.DeserializeObject <List <string> >(evData.SpeechersList);
                foreach (string speakerId in speakersIds)
                {
                    evData.Speechers.Add(Speakers.Find(speakerId));
                }
            }
            PayedEvents.UpdateData(eventsData.FindAll(temp => !temp.FreeAttending));
            FreeEvents.UpdateData(eventsData.FindAll(temp => temp.FreeAttending));

            WallPostLikes = new DynamicListData <WallPostLike>();
            List <WallPostLike> likesData = DbClient.Instance.GetData <WallPostLike>().Result;

            foreach (WallPostLike like in likesData)
            {
                like.User = Users.Find(like.UserId);
            }
            WallPostLikes.UpdateData(likesData);

            WallPosts = new DynamicListData <WallPost>();
            List <WallPost> wallPostData = DbClient.Instance.GetData <WallPost>().Result;

            foreach (WallPost wallPost in wallPostData)
            {
                wallPost.CreatedUser = Users.Find(wallPost.CreatedUserId);

                List <WallPostLike> likes = WallPostLikes.Items.FindAll(temp => temp.Post.Equals(wallPost.Id));
                foreach (WallPostLike likeData in likes)
                {
                    wallPost.LikeList.Add(likeData.User);
                }
            }
            WallPosts.UpdateData(wallPostData);

            ExhibitorsWrapper  = new ExhibitorsDataWrapper(SponsorTypes, Exhibitors, false);
            FreeEventsWrapper  = new EventsDataWrapper(FreeEvents);
            PayedEventsWrapper = new EventsDataWrapper(PayedEvents);
            WallPostsWrapper   = new WallPostsDataWrapper(WallPosts);
            UsersModelsWrapper = new UserModelsWrapper(Users);

            FreeEventsGridWrapper  = new EventsGridWrapper(FreeEvents);
            PayedEventsGridWrapper = new EventsGridWrapper(PayedEvents);
        }