private async Task CheckForSavedUser(string userid)
        {
            SavedUserModel saveduserModel = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                saveduserModel = WebService.CheckSavedUser(userid);
            }).ContinueWith(async
                            t =>
            {
                if (saveduserModel != null)
                {
                    if (saveduserModel.data[0].user_is_favorite)
                    {
                        isFavourite     = true;
                        imgHeart.Source = "h.png";
                    }
                    else
                    {
                        isFavourite     = false;
                        imgHeart.Source = "h_unlike";
                    }
                }
                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
Пример #2
0
        private async Task GetAllSavedUsers()
        {
            SavedUserModel model = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(

                () =>
            {
                model = WebService.GetSavedUser();
            }).ContinueWith(async
                            t =>
            {
                if (model != null)
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        for (int i = 0; i < model.data.Count; i++)
                        {
                            if (!string.IsNullOrEmpty(model.data[i].profile_pic))
                            {
                                model.data[i].profile_pic = Constants.ProfilePicUrl + model.data[i].profile_pic;
                            }
                            else
                            {
                                model.data[i].profile_pic = "dummyprofile.png";
                            }
                        }
                        flowlistview.FlowItemsSource = model.data;
                    });
                }


                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }