public void DownloadWallPostLikes(DynamicListData <WallPostLike> wallPostLikes, WallPost wallPost, Action onFinish) { var requestTask = new DownloadWallPostLikesBackgroundTask(wallPost, wallPostLikes); requestTask.ContinueWith((task, result) => Device.BeginInvokeOnMainThread(onFinish)); _backgroundWorkers[AppBackgroundWorkerType.DownloadWallPostLikes].Add(requestTask); }
public void UpdateRating(DynamicListData <User> users, Action onFinish) { /* TODO reativar ranking AppController */ UserDialogs.Instance.ShowLoading(AppResources.LoadingRanking); var parameters = new KinveyDownloadListParameters(KinveyDownloadCountType.FirstPage, QueryBuilder.Instance.GetRankingKinveyQuery()); var requestTask = new DownloadUsersBackgroundTask(AppModel.Instance.Users, parameters); requestTask.ContinueWith((task, result) => { UserDialogs.Instance.HideLoading(); if (result == null) { AppProvider.PopUpFactory.ShowMessage(AppResources.FailedServer, AppResources.Error); } else { users.ClearData(); users.UpdateData(result); Device.BeginInvokeOnMainThread(onFinish); } }); _backgroundWorkers[AppBackgroundWorkerType.DownloadRanking].Add(requestTask); }
public UserModel(User user) { Id = user.Id; User = user; UpdatedAtTime = user.UpdatedAtTime; Connections = new DynamicListData <ConnectRequest> (); BadgeActions = new DynamicListData <BadgeAction> (); FavouriteActions = new DynamicListData <FavouriteEventData> (); VoteData = new DynamicListData <UserVoteData> (); FavoriteEvents = new DynamicListData <EventData>(); AcceptedConnections = new DynamicListData <ConnectRequest> (); Connections.CollectionChanged += OnConnectionsChanged; }
public void DownloadEventsData(bool isFree, Action onFinish) { DynamicListData <EventData> events = isFree ? AppModel.Instance.FreeEvents : AppModel.Instance.PayedEvents; var task = new DownloadEventsDataBackgroundTask(isFree, events); task.ContinueWith((ttask, tresult) => Device.BeginInvokeOnMainThread(onFinish)); if (isFree) { _backgroundWorkers[AppBackgroundWorkerType.DownloadFreeEvents].Add(task); } else { _backgroundWorkers[AppBackgroundWorkerType.DownloadPayedEvents].Add(task); } }
public void SearchUsers(DynamicListData <User> dataModel, string pattern, Action onFinish) { String searchPatern = FirstCharToUpper(pattern); //TODO reativar Search user AppController var parameters = new KinveyDownloadListParameters(KinveyDownloadCountType.All, QueryBuilder.Instance.GetSearchUsersKinveyQuery(searchPatern)); var searchTask = new DownloadUsersBackgroundTask(dataModel, parameters); searchTask.ContinueWith((task, result) => { Device.BeginInvokeOnMainThread(onFinish); if (result == null) { AppProvider.PopUpFactory.ShowMessage(AppResources.FailedServer, AppResources.Error); } }); _backgroundWorkers[AppBackgroundWorkerType.SearchUsers].Add(searchTask); }
public void SearchExhibitors(string pattern, DynamicListData <Exhibitor> searchModel, Action onFinish) { UserDialogs.Instance.ShowLoading(AppResources.LoadingSearchExhibitors); var parameters = new KinveyDownloadListParameters(KinveyDownloadCountType.All, QueryBuilder.Instance.GetSearchExhibitorsKinveyQuery(pattern)); var searchTask = new DownloadExhibitorsBackgroundTask(searchModel, parameters); searchTask.ContinueWith((task, result) => { Device.BeginInvokeOnMainThread(onFinish); UserDialogs.Instance.HideLoading(); if (result == null) { AppProvider.PopUpFactory.ShowMessage(AppResources.FailedServer, AppResources.Error); } }); _backgroundWorkers[AppBackgroundWorkerType.SearchExhibitors].Add(searchTask); }
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); }