Beispiel #1
0
        private async void LoadPage()
        {
            _ProgressBar.IsIndeterminate = true;
            var res = await AppCore.InstaApi.GetUserTimelineFeedAsync(InstaSharper.Classes.PaginationParameters.MaxPagesToLoad(1));

            if (res.Info.Message == "login_required")
            {
                //AppCore.InstaApi = null;
                AppCore.SaveUserInfo(null, null, false);
                MainPage.MainFrame.GoBack();
                return;
            }
            var strs = await AppCore.InstaApi.GetStoryFeedAsync();

            StoriesList.ItemsSource = strs.Value.Items.OrderBy(x => x.Seen != 0);

            if (HomePageItemssource != null)
            {
                HomePageItemssource.CollectionChanged -= HomePageItemssource_CollectionChanged;
            }

            HomePageItemssource = new GenerateHomePage <InstaMedia>(100000, (count) =>
            {
                //return tres[count];
                return(new InstaMedia());
            });

            HomePageItemssource.CollectionChanged += HomePageItemssource_CollectionChanged;
            //MediasCVS.Source = HomePageItemssource;
            mylist.ItemsSource = HomePageItemssource;

            //await HomePageItemssource.LoadMoreItemsAsync(20);

            //mylist.ItemsSource = res.Value.Medias;

            //mylist.ItemsSource = res.Value.Medias;

            _ProgressBar.IsIndeterminate = false;
            var sv = FindChildOfType <ScrollViewer>(mylist);

            sv.ViewChanged += Sv_ViewChanged;
            //await Task.Delay(2000);
            //DirectFr.Navigate(typeof(DirectsListView));
            //MainPage.MainFrame.Navigate(typeof(DirectsListView));
        }
Beispiel #2
0
        private async void LoadPage()
        {
            _ProgressBar.IsIndeterminate = true;
            var p   = PaginationParameters.MaxPagesToLoad(1);
            var res = await AppCore.InstaApi.GetDirectInboxAsync(p);

            p.NextId = res.Value.Inbox.OldestCursor;
            var res2 = await AppCore.InstaApi.GetDirectInboxAsync(p);

            if (res.Info.Message == "login_required")
            {
                //AppCore.InstaApi = null;
                AppCore.SaveUserInfo(null, null, false);
                MainPage.MainFrame.GoBack();
                return;
            }


            //TEST
            var User = AppCore.InstaApi.GetLoggedUser();
            var user = await AppCore.InstaApi.GetUserInfoByUsernameAsync(User.UserName);

            var items = await AppCore.InstaApi.GetUserStoryFeedAsync(user.Value.Pk);

            InstaUserShort You = new InstaUserShort()
            {
                UserName = "******", ProfilePicture = user.Value.ProfilePicUrl, Pk = user.Value.Pk
            };
            InstaReelFeed MyReel = new InstaReelFeed();

            MyReel.User = You;
            //MyReel.Seen = 0;
            MyReel.Items = items.Value.Items;
            //var m = (await AppCore.InstaApi.GetUserTimelineFeedAsync(p));
            //var first = m.Value.Medias.LastOrDefault();
            //var s = await AppCore.InstaApi.GetMediaCommentsAsync(first.InstaIdentifier.ToString(), p);

            //var sss = "";

            //          var ss = await AppCore.InstaApi.GetMediaLikersAsync(first.InstaIdentifier.ToString());

            //var sssds = "";
            var strs = await AppCore.InstaApi.GetStoryFeedAsync();

            if (strs.Value.Items.Exists(x => x.User.Pk == user.Value.Pk))
            {
                //strs.Value.Items.OrderBy(x => x.Seen != 0);
                var MyRemove = strs.Value.Items.FindIndex(x => x.User.Pk == user.Value.Pk);
                MyReel.Seen            = strs.Value.Items[MyRemove].Seen;
                MyReel.LatestReelMedia = strs.Value.Items[MyRemove].LatestReelMedia;
                strs.Value.Items.RemoveAt(MyRemove);
            }

            //

            strs.Value.Items.OrderBy(x => x.Seen_ranked_position != 0);
            strs.Value.Items.Insert(0, MyReel);

            StoriesList.ItemsSource = strs.Value.Items;
            if (HomePageItemssource != null)
            {
                HomePageItemssource.CollectionChanged -= HomePageItemssource_CollectionChanged;
            }

            HomePageItemssource = new GenerateHomePage <InstaMedia>(100000, (count) =>
            {
                //return tres[count];
                return(new InstaMedia());
            });

            HomePageItemssource.CollectionChanged += HomePageItemssource_CollectionChanged;
            //MediasCVS.Source = HomePageItemssource;
            mylist.ItemsSource = HomePageItemssource;

            //await HomePageItemssource.LoadMoreItemsAsync(20);

            //mylist.ItemsSource = res.Value.Medias;

            //mylist.ItemsSource = res.Value.Medias;

            _ProgressBar.IsIndeterminate = false;
            var sv = FindChildOfType <ScrollViewer>(mylist);

            sv.ViewChanged += Sv_ViewChanged;
            //await Task.Delay(2000);
            //DirectFr.Navigate(typeof(DirectsListView));
            //MainPage.MainFrame.Navigate(typeof(DirectsListView));
        }