private async void ScrollableUserPostViewLoaded(object sender, RoutedEventArgs e)
        {
            ToggleGoUpButtonAnimation(false);
            try
            {
                if (NavigationMode == NavigationMode.Back && ScrollableUserPostVM.User != null)
                {
                    if (ScrollableUserPostVM.User.Pk == User.Pk)
                    {
                        return;
                    }
                }
                else if (NavigationMode == NavigationMode.New)
                {
                    NavigationCacheMode = NavigationCacheMode.Enabled;
                    CanLoadFirstPopUp   = false;
                }
                if (!CanLoadFirstPopUp)
                {
                    if (Scroll == null)
                    {
                        Scroll = LVPosts.FindScrollViewer();
                        if (Scroll != null)
                        {
                            Scroll.ViewChanging += ScrollViewViewChanging;
                        }
                    }
                    //LVPosts.ItemsSource = null;
                    ScrollableUserPostVM.ResetCache();

                    ScrollableUserPostVM.SetInfo(User?.ToUserShort(), MediaGeneratror, Scroll);
                    LVPosts.ItemsSource = ScrollableUserPostVM.MediaGeneratror.Items;
                    //LVPosts.ItemsSource = ScrollableUserPostVM.MediaGeneratror.ItemsX;
                    await Task.Delay(500);

                    LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.Items[SelectedIndex]);
                    //LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.ItemsX[SelectedIndex]);
                    CanLoadFirstPopUp = true;
                }
            }
            catch { }
        }
Exemplo n.º 2
0
        private async void LVMenuItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                if (e.ClickedItem != null && e.ClickedItem is MenuClass menu && menu != null)
                {
                    try
                    {
                        switch (menu.Command)
                        {
                        case CommandType.CopyUsername:
                            User.UserName.CopyText();
                            MainPage.Current.ShowInAppNotify($"{User.UserName} copied ;)", 1500);
                            Hide();
                            break;

                        case CommandType.CopyUsernameAddress:
                            var uAddress = $"https://instagram.com/{User.UserName.ToLower()}";
                            uAddress.CopyText();
                            MainPage.Current.ShowInAppNotify($"{uAddress} copied ;)", 1500);
                            Hide();
                            break;

                        case CommandType.DownloadProfilePicture:
                            StartDownload();
                            Hide();
                            break;

                        case CommandType.ShareThisProfile:
                            Hide();
                            await new UsersDialog(User.ToUserShort()).ShowAsync();
                            break;

                        case CommandType.Block:
                            await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                            {
                                var result = await Helper.InstaApi.UserProcessor.BlockUserAsync(User.Pk);
                                if (result.Succeeded)
                                {
                                    if (FriendshipStatus != null)
                                    {
                                        FriendshipStatus.Blocking = result.Value.Blocking;
                                    }
                                    Helper.ShowNotify($"@{User.UserName.ToLower()} blocked...", 1500);
                                }
                            });

                            break;

                        case CommandType.Unblock:
                            await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                            {
                                var result = await Helper.InstaApi.UserProcessor.UnBlockUserAsync(User.Pk);
                                if (result.Succeeded)
                                {
                                    if (FriendshipStatus != null)
                                    {
                                        FriendshipStatus.Blocking = result.Value.Blocking;
                                    }
                                    Helper.ShowNotify($"@{User.UserName.ToLower()} unblocked...", 1500);
                                }
                            });

                            break;

                        case CommandType.ShowYourStory:
                            await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                            {
                                var result = await Helper.InstaApi.UserProcessor.UnHideMyStoryFromUserAsync(User.Pk);
                                if (result.Succeeded)
                                {
                                    if (FriendshipStatus != null)
                                    {
                                        FriendshipStatus.IsBlockingReel = result.Value.IsBlockingReel;
                                    }

                                    Helper.ShowNotify($"Your stories is now visibile for @{User.UserName.ToLower()}...", 1500);
                                }
                            });

                            break;

                        case CommandType.HideYourStory:
                            await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                            {
                                var result = await Helper.InstaApi.UserProcessor.HideMyStoryFromUserAsync(User.Pk);
                                if (result.Succeeded)
                                {
                                    if (FriendshipStatus != null)
                                    {
                                        FriendshipStatus.IsBlockingReel = result.Value.IsBlockingReel;
                                    }
                                    Helper.ShowNotify($"Your stories is now hidden for @{User.UserName.ToLower()}...", 1500);
                                }
                            });

                            break;

                        case CommandType.Mute:
                            Hide();
                            await new MuteDialog(User.ToUserShort()).ShowAsync();
                            break;

                        case CommandType.UnMute:
                            await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                            {
                                var result = await Helper.InstaApi.UserProcessor.UnMuteUserMediaAsync(User.Pk, InstagramApiSharp.Enums.InstaMuteOption.All);
                                if (result.Succeeded && FriendshipStatus != null)
                                {
                                    if (FriendshipStatus != null)
                                    {
                                        FriendshipStatus.Muting = result.Value.Muting;
                                    }
                                    Helper.ShowNotify($"@{User.UserName.ToLower()} unmuted...", 1500);
                                }
                            });

                            break;

                        case CommandType.SendMessage:
                            try
                            {
                                var userFriendShip = new InstaUserShortFriendship
                                {
                                    UserName                   = User.UserName,
                                    Pk                         = User.Pk,
                                    FullName                   = User.FullName,
                                    ProfilePicUrl              = User.ProfilePicUrl,
                                    ProfilePicture             = User.ProfilePicture,
                                    HasAnonymousProfilePicture = User.HasAnonymousProfilePicture,
                                    IsBestie                   = User.IsBestie,
                                    IsPrivate                  = User.IsPrivate,
                                    IsVerified                 = User.IsVerified,
                                    ProfilePictureId           = User.ProfilePictureId,
                                    FriendshipStatus           = new InstaFriendshipShortStatus
                                    {
                                        Following       = FriendshipStatus.Following,
                                        IncomingRequest = FriendshipStatus.IncomingRequest,
                                        IsBestie        = FriendshipStatus.IsBestie,
                                        IsPrivate       = FriendshipStatus.IsPrivate,
                                        OutgoingRequest = FriendshipStatus.OutgoingRequest,
                                        Pk = User.Pk
                                    }
                                };
                                NavigationService.Navigate(typeof(Views.Direct.ThreadView), userFriendShip);
                            }
                            catch { }
                            break;
                        }

                        Hide();
                    }
                    catch { Hide(); }
                }
            }
            catch { Hide(); }
        }