Beispiel #1
0
        public ProjectionControlVmD()
        {
            Title  = "Design Title";
            TitleX = "Design X";
            TitleY = "Design Y";

            ItemsX.ForEach(v => XSelectorVm.AddItem(v, v.ToString()));
            ItemsY.ForEach(v => YSelectorVm.AddItem(v, v.ToString()));
        }
Beispiel #2
0
 public void ResetCache()
 {
     Hashtag      = null;
     PageCount    = 1;
     Pagination   = PaginationParameters.MaxPagesToLoad(1);
     IsLoading    = true;
     HasMoreItems = true;
     Items.Clear();
     ItemsX.Clear();
     FirstRun = true;
     IsMine   = false;
 }
Beispiel #3
0
 public void ResetCache()
 {
     try
     {
         Items.Clear();
         ItemsX.Clear();
         HasMoreItems = true;
         IsLoading    = true;
         FirstRun     = true;
         Pagination   = PaginationParameters.MaxPagesToLoad(2);
     }
     catch { }
 }
 public void ResetCache()
 {
     try
     {
         ClusterId    = "explore_all:0";
         clusterName_ = "";
         Channel      = null;
         FirstRun     = true;
         Items.Clear();
         ItemsX.Clear();
         Clusters.Clear();
         Pagination   = PaginationParameters.MaxPagesToLoad(1);
         HasMoreItems = true;
         IsLoading    = true;
     }
     catch { }
 }
        async Task LoadMoreItemsAsync(bool refresh = false)
        {
            if (!HasMoreItems && !refresh)
            {
                IsLoading = false;
                return;
            }
            try
            {
                if (refresh)
                {
                    PageCount  = 1;
                    Pagination = PaginationParameters.MaxPagesToLoad(1);
                    try
                    {
                        Views.Main.ExploreView.Current?.ShowTopLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Main.ExploreClusterView.Current?.ShowTopLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableExplorePostView.Current?.ShowTopLoading();
                    //}
                    //catch { }
                }
                else
                {
                    try
                    {
                        Views.Main.ExploreView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Main.ExploreClusterView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableExplorePostView.Current?.ShowBottomLoading();
                    //}
                    //catch { }
                }

                var result = await InstaApi.FeedProcessor.GetTopicalExploreFeedAsync(Pagination, ClusterId);

                //if (DeviceUtil.IsMobile)
                Pagination.MaximumPagesToLoad = 2;
                PageCount++;
                FirstRun = false;
                if (!result.Succeeded)
                {
                    IsLoading = false;
                    if (result.Value == null || result.Value.Medias?.Count == 0)
                    {
                        Hide(refresh);
                        return;
                    }
                }

                HasMoreItems = result.Value.MoreAvailable;

                Pagination.NextMaxId = result.Value.NextMaxId;
                if (refresh)
                {
                    Items.Clear();
                    ItemsX.Clear();
                }
                if (result.Value.Medias?.Count > 0)
                {
                    //Items.AddRange(result.Value.Medias);
                    //ItemsX.AddRange(result.Value.Medias);
                    for (int i = 0; i < result.Value.Medias.Count; i++)
                    {
                        var l = result.Value.Medias[i];
                        if (!Items.Any(x => x.InstaIdentifier == l.InstaIdentifier))
                        {
                            Items.Add(l);
                            //ItemsX.Add(l);
                        }
                    }
                }
                if (result.Value.Clusters?.Count > 0)
                {
                    Clusters.Clear();
                    if (result.Value.Clusters[0].Title.ToLower() == "for you")
                    {
                        result.Value.Clusters.RemoveAt(0);
                    }
                    Clusters.AddRange(result.Value.Clusters);
                }
                if (result.Value.Channel != null)
                {
                    Channel = result.Value.Channel;
                }
                await Task.Delay(1000);

                IsLoading = false;
                if (refresh /*&& DeviceUtil.IsMobile*/)
                {
                    RunLoadMore();
                }
            }
            catch (Exception ex)
            {
                ex.PrintException("ExploreClusterGenerator.LoadMoreItemsAsync");
            }
            FirstRun = IsLoading = false;
            Hide(refresh);
        }
Beispiel #6
0
        async Task LoadMoreItemsAsync(bool refresh = false)
        {
            if (!HasMoreItems && !refresh)
            {
                IsLoading = false;
                return;
            }
            try
            {
                if (refresh)
                {
                    PageCount  = 1;
                    Pagination = PaginationParameters.MaxPagesToLoad(2);
                    try
                    {
                        Views.Infos.UserDetailsView.Current?.ShowTopLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Infos.ProfileDetailsView.Current?.ShowTopLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableUserPostView.Current?.ShowTopLoading();
                    //}
                    //catch { }
                }
                else
                {
                    try
                    {
                        Views.Infos.UserDetailsView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Infos.ProfileDetailsView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableUserPostView.Current?.ShowBottomLoading();
                    //}
                    //catch { }
                }
                var result = await InstaApi.BusinessProcessor.GetUserShoppableMediaByIdAsync(UserId, Pagination);

                PageCount++;
                FirstRun = false;
                Pagination.MaximumPagesToLoad = 2;
                if (!result.Succeeded)
                {
                    IsLoading = false;
                    if (result.Value == null || result.Value?.Count == 0)
                    {
                        Hide(refresh);
                        return;
                    }
                }

                HasMoreItems = result.Value.NextMaxId != null;

                Pagination.NextMaxId = result.Value.NextMaxId;
                if (refresh)
                {
                    Items.Clear();
                    ItemsX.Clear();
                }
                if (result.Value?.Count > 0)
                {
                    Items.AddRange(result.Value);
                    //ItemsX.AddRange(result.Value);
                }
                await Task.Delay(1000);

                IsLoading = false;
            }
            catch (Exception ex)
            {
                FirstRun      =
                    IsLoading = false;
                ex.PrintException("UserDetailsShopMediasGenerator.LoadMoreItemsAsync");
            }
            Hide(refresh);
        }
        async Task LoadMoreItemsAsync(bool refresh = false)
        {
            if (!IsMine)
            {
                return;
            }
            if (!HasMoreItems && !refresh)
            {
                IsLoading = false;
                return;
            }
            try
            {
                if (refresh)
                {
                    PageCount   = 1;
                    Pagination  = PaginationParameters.MaxPagesToLoad(1);
                    HashtagType = InstaHashtagSectionType.All;
                    try
                    {
                        Views.Infos.HashtagView.Current?.ShowTopLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableHashtagPostView.Current?.ShowTopLoading();
                    //}
                    //catch { }
                }
                else
                {
                    try
                    {
                        Views.Infos.HashtagView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableHashtagPostView.Current?.ShowBottomLoading();
                    //}
                    //catch { }
                }
                var result = await InstaApi.HashtagProcessor.GetHashtagsSectionsAsync(Hashtag, Pagination, HashtagType);

                PageCount++;
                FirstRun = false;
                if (!result.Succeeded)
                {
                    IsLoading = false;
                    if (result.Value == null || result.Value.Medias?.Count == 0)
                    {
                        Hide(refresh);
                        return;
                    }
                }

                HasMoreItems = result.Value.MoreAvailable;

                Pagination.NextMaxId = result.Value.NextMaxId;
                if (refresh)
                {
                    Items.Clear();
                }
                if (result.Value.Medias?.Count > 0)
                {
                    Items.AddRange(result.Value.Medias);
                    ItemsX.AddRange(result.Value.Medias);
                }
                if (result.Value.RelatedHashtags?.Count > 0)
                {
                    RelatedHashtags.Clear();
                    RelatedHashtags.AddRange(result.Value.RelatedHashtags);
                }
                if (result.Value.Channel != null)
                {
                    Channel = result.Value.Channel;
                }
                await Task.Delay(1000);

                IsLoading = false;
            }
            catch (Exception ex)
            {
                FirstRun      =
                    IsLoading = false;
                ex.PrintException("HashtagsRecentGenerator.LoadMoreItemsAsync");
            }
            HashtagType = InstaHashtagSectionType.Top;
            Hide(refresh);
        }
Beispiel #8
0
        async Task LoadMoreItemsAsync(bool refresh = false)
        {
            if (!HasMoreItems && !refresh)
            {
                IsLoading = false;
                return;
            }
            try
            {
                if (refresh)
                {
                    PageCount  = 1;
                    Pagination = PaginationParameters.MaxPagesToLoad(1);
                    try
                    {
                        Views.Infos.ArchiveView.Current?.ShowTopLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Infos.ArchiveView.Current?.ScrollableArchivePostUc.ShowTopLoading();
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        Views.Infos.ArchiveView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Infos.ArchiveView.Current?.ScrollableArchivePostUc.ShowBottomLoading();
                    }
                    catch { }
                }

                var result = await InstaApi.MediaProcessor.GetArchivedMediaAsync(Pagination);

                Pagination.MaximumPagesToLoad = 1;
                PageCount++;
                FirstRun = false;
                if (!result.Succeeded)
                {
                    IsLoading = false;
                    if (result.Value == null || result.Value?.Count == 0)
                    {
                        Hide(refresh);
                        if (Items.Count == 0)
                        {
                            NoArchivedPostsVisibility = Visibility.Visible;
                        }
                        else
                        {
                            NoArchivedPostsVisibility = Visibility.Collapsed;
                        }
                        return;
                    }
                }

                HasMoreItems = !string.IsNullOrEmpty(result.Value.NextMaxId);

                Pagination.NextMaxId = result.Value.NextMaxId;
                if (refresh)
                {
                    Items.Clear();
                    ItemsX.Clear();
                }
                if (result.Value?.Count > 0)
                {
                    Items.AddRange(result.Value);
                }
                if (Items.Count == 0)
                {
                    NoArchivedPostsVisibility = Visibility.Visible;
                }
                else
                {
                    NoArchivedPostsVisibility = Visibility.Collapsed;
                }
                await Task.Delay(1000);

                IsLoading = false;
                if (refresh /*&& DeviceUtil.IsMobile*/)
                {
                    RunLoadMore();
                }
            }
            catch (Exception ex)
            {
                ex.PrintException("ArchiveViewModel.LoadMoreItemsAsync");
            }
            FirstRun = IsLoading = false;
            Hide(refresh);
        }