async void GetUserInfo() { try { var userInfo = await InstaApi.UserProcessor.GetUserInfoByIdAsync(UserShort.Pk); if (userInfo.Succeeded) { ChainingSuggestions.Clear(); User = userInfo.Value; View.CreateTabs(User.TotalIGTVVideos > 0, User.ShoppablePostsCount > 0, User.UsertagsCount > 0); if (User != null) { GetPosts(true); } //if (!FirstTime) View.UpdateUserImage(User.ProfilePicUrl); if (userInfo.Value.ChainingSuggestions?.Count > 0) { ChainingSuggestions.AddRange(User.ChainingSuggestions); ChainingVisibility = Visibility.Visible; await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var users = userInfo.Value.ChainingSuggestions.Select(x => x.Pk); var statuses = await InstaApi.UserProcessor.GetFriendshipStatusesAsync(users.ToArray()); ($"users count: {users.Count()}").PrintDebug(); ($"statuses count: {statuses.Value.Count}").PrintDebug(); foreach (var item in statuses.Value) { try { var u = ChainingSuggestions.SingleOrDefault(s => s.Pk == item.Pk); if (u != null) { u.FriendshipStatus = item; } } catch { } } }); } else { ChainingVisibility = Visibility.Collapsed; } } else { if (userInfo.Info.Message.ToLower().Contains("user not found")) { $"User not found.\r\n@{UserShort.UserName} doesn't exists.".ShowErr(); } FriendshipStatus = new InstaStoryFriendshipStatus(); ChainingVisibility = Visibility.Collapsed; } } catch { } //FirstTime = false; }
//public void SetScrollViewer(ScrollViewer scrollViewer) //{ // MediaGeneratror.SetLV(scrollViewer); // //if (User != null) // // GetPosts(); //} async void GetUserInfo() { try { await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var userInfo = await UserHelper.GetSelfUserAsync(); if (userInfo != null) { View.SetBusinessProfile(); ChainingSuggestions.Clear(); User = userInfo; View.CreateTabs(User.TotalIGTVVideos > 0, User.ShoppablePostsCount > 0, User.UsertagsCount > 0); //if (!FirstTime) View.UpdateUserImage(User.ProfilePicture); if (userInfo.ChainingSuggestions?.Count > 0) { ChainingSuggestions.AddRange(User.ChainingSuggestions); ChainingVisibility = Visibility.Visible; var users = userInfo.ChainingSuggestions.Select(x => x.Pk); var statuses = await InstaApi.UserProcessor.GetFriendshipStatusesAsync(users.ToArray()); ($"users count: {users.Count()}").PrintDebug(); ($"statuses count: {statuses.Value.Count}").PrintDebug(); foreach (var item in statuses.Value) { try { var u = ChainingSuggestions.SingleOrDefault(s => s.Pk == item.Pk); if (u != null) { u.FriendshipStatus = item; } } catch { } } } else { ChainingVisibility = Visibility.Collapsed; } } else { ChainingVisibility = Visibility.Collapsed; } }); } catch { } //FirstTime = false; }
public void ResetToDefault() { if (BiographyText != null) { BiographyText.Blocks.Clear(); } MediaGeneratror.ResetCache(); UserShort = null; FriendshipStatus = null; User = null; Username = null; TVChannel = null; Highlights.Clear(); Stories.Clear(); ChainingSuggestions.Clear(); PrivateVisibility = NoPostsVisibility = ChainingVisibility = IGTVVisibility = HighlightsVisibility = Visibility.Collapsed; View = null; }