async Task ExecuteLoadStoriesCommand() { if (IsBusy) { return; } IsBusy = true; try { Stories.Clear(); var stories = await FirebaseService.GetItemsAsync(true); foreach (var story in stories) { Stories.Add(story); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async void GetStories() { try { await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { //var stories = await InstaApi.StoryProcessor.GetUsersStoriesAsHighlightsAsync(User.Pk.ToString()); //if (stories.Succeeded) //{ // Stories.Clear(); // if (stories.Value.Items?.Count > 0) // Stories.AddRange(stories.Value.Items); //} var st = await InstaApi.StoryProcessor.GetUserStoryAndLivesAsync(User.Pk); if (st.Succeeded) { Stories.Clear(); if (st.Value.Reel != null) { Stories.Add(st.Value.Reel); } SetBroadcast(st.Value.Broadcast); } else { SetBroadcast(null); } }); } catch { } }
public void ResetCache() { HashtagText = null; Hashtag = null; Owner = null; Reel = null; Stories.Clear(); HashtagsRecentGenerator.ResetCache(); HashtagsTopGenerator.ResetCache(); }
public override void ViewAppeared() { base.ViewAppeared(); Stories.Clear(); _ = _storiesRepository .GetStories() .Select(_mapper.Map <StoryViewModel>) .Aggregate(Stories, (acc, e) => { acc.Add(e); return(acc); }); }
public void ClearView() { HeroImage = null; HeroNameText = ""; HeroPhoneticText = ""; MessageText = ""; m_GradeNum = 0; m_NextGradeNum = 0; IllustratorText = ""; Skills.Clear(); Stories.Clear(); ContentPosY = 0; }
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; }
private void GetData() { Status = "Starting sync get data at " + DateTime.Now.ToLongTimeString(); Stories.Clear(); var webClient = new System.Net.WebClient(); string content = webClient.DownloadString("https://sport.orf.at"); Thread.Sleep(30_000); var findStoriesRegex = new Regex("ticker-story-headline.*?a href.*?>(.*?)<\\/a>", RegexOptions.IgnoreCase | RegexOptions.Singleline); var matches = findStoriesRegex.Matches(content); foreach (Match match in matches) { Stories.Add(match.Groups[1].ToString().Trim()); } }
async void GetHashtagStories() { try { await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var s = await Helper.InstaApi.HashtagProcessor.GetHashtagStoriesAsync(HashtagText); if (s.Succeeded) { Reel = s.Value.ToReel(); Stories.Clear(); Stories.AddRange(s.Value.Items); Owner = s.Value.Owner; } }); } catch { } }
async void GetStories() { try { await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var stories = await InstaApi.StoryProcessor.GetUsersStoriesAsHighlightsAsync(UserShort.Pk.ToString()); if (stories.Succeeded) { Stories.Clear(); if (stories.Value.Items?.Count > 0) { Stories.AddRange(stories.Value.Items); } } }); } catch { } }
private async Task GetDataAsync() { Status = "Starting async get data at " + DateTime.Now.ToLongTimeString(); await Task.Run(async() => { Application.Current.Dispatcher.Invoke(() => { Stories.Clear(); }); var webClient = new System.Net.WebClient(); Task <string> contentTask = webClient.DownloadStringTaskAsync("https://sport.orf.at"); await Task.Delay(30_000); var findStoriesRegex = new Regex("ticker-story-headline.*?a href.*?>(.*?)<\\/a>", RegexOptions.IgnoreCase | RegexOptions.Singleline); var matches = findStoriesRegex.Matches(await contentTask); Application.Current.Dispatcher.Invoke(() => { foreach (Match match in matches) { Stories.Add(match.Groups[1].ToString().Trim()); } }); }); }
async Task ExecuteLoadItemsCommand() { IsBusy = true; try { var stories = await StoryService.ListByProfileAsync(User.Id); Stories.Clear(); foreach (var story in stories.OrderByDescending(s => s.Id)) { Stories.Add(story); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async Task Refresh(CancellationToken ct) { Stories.Clear(); await foreach (var story in _remoteRepository.TopStoriesAsync()) { if (ct.IsCancellationRequested) { return; } var storyViewModel = await story.ToViewModelAsync(); if (ct.IsCancellationRequested) { return; } Stories.Add(storyViewModel); IsRefreshing = false; } _cts = null; }
public async void RefreshStories(bool refresh = false) { try { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { var stories = await InstaApi.StoryProcessor.GetStoryFeedWithPostMethodAsync(refresh); if (stories.Succeeded) { Stories.Clear(); StoriesX.Clear(); var listX = new List <StoryWithLiveSupportModel>(); if (stories.Value.Broadcasts?.Count > 0) { for (int i = 0; i < stories.Value.Broadcasts.Count; i++) { var item = stories.Value.Broadcasts[i]; listX.Add(new StoryWithLiveSupportModel { Broadcast = item, Type = StoryType.Broadcast }); } } if (stories.Value.Items?.Count > 0) { var list = new List <StoryModel>(); string id = null; for (int i = 0; i < stories.Value.Items.Count; i++) { var item = stories.Value.Items[i]; var m = item.ToStoryModel(); if (string.IsNullOrEmpty(id) || !string.IsNullOrEmpty(id) && id != item.Id) { list.Add(m); listX.Add(new StoryWithLiveSupportModel { Story = item.ToStoryModel(), Type = StoryType.Story }); } id = item.Id; } id = null; Stories.AddRange(list); if (stories.Value.Items?.Count > 0) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { var users = new List <string>(); foreach (var item in stories.Value.Items.Take(5))// 5ta ro migirim! //if (item.IsHashtag) // users.Add(item.Owner.Pk.ToString()); //else //users.Add(item.User.Pk.ToString()); { users.Add(item.Id); } var storiesAfterResult = await InstaApi.StoryProcessor.GetUsersStoriesAsHighlightsAsync(users.ToArray()); if (storiesAfterResult.Succeeded) { var storiesAfter = storiesAfterResult.Value.Items; for (int i = 0; i < Stories.Count; i++) { var item = Stories[i]; //var single = storiesAfter.SingleOrDefault(ss => ss.User.Pk.ToString() == item.User.Pk.ToString()); var single = storiesAfter.SingleOrDefault(ss => ss.Id == item.Id); if (single != null) { item.Items.Clear(); item.Items.AddRange(single.Items); } } } StoreisVisibility = Visibility.Visible; }); } } if (stories.Value.PostLives?.Count > 0) { for (int i = 0; i < stories.Value.PostLives.Count; i++) { var item = stories.Value.PostLives[i]; listX.Add(new StoryWithLiveSupportModel { PostLives = item, Type = StoryType.PostLive }); } } StoriesX.AddRange(listX); } else { if (stories.Info.ResponseType == ResponseType.LoginRequired) { MainPage.Current.LoggedOut(); } if (Stories.Count == 0) { StoreisVisibility = Visibility.Collapsed; } if (stories.Info.ResponseType == ResponseType.ConsentRequired) { ShowNotify("Consent is required!\r\nLet Minista fix it for you ;-)\r\nTrying.... Give me 30 seconds maximum...", 3500); await Task.Delay(TimeSpan.FromSeconds(8)); var acceptConsent = await InstaApi.AcceptConsentAsync(); await Task.Delay(TimeSpan.FromSeconds(15)); ShowNotify("Consent is fixed (I think) let me try to refresh feeds and other stuffs for u.", 2500); MainView.Current?.TryToRefresh(true); } } }); } catch (Exception ex) { ex.PrintException("MainViewModel.RefreshStories"); } refresh = false; }
internal void RemoveAllStories() { Stories.Clear(); }