public PatternSet(XElement node) : this() { // Migrate old versions #region Upgrade PatternSet { // Add a null version if not found if (node.Element(XmlTag.Version) == null) { node.Add(new XElement(XmlTag.Version, string.Empty)); } for (string version; (version = node.Element(XmlTag.Version).Value) != Constants.PatternSetVersion;) { switch (version) { default: throw new Exception($"Version {version} Pattern Set is not supported"); case "v1.0": // Latest break; } } } #endregion var highlights_node = node.Element(XmlTag.Highlights); if (highlights_node != null) { Highlights.AddRange(highlights_node.Elements(XmlTag.Highlight).Select(x => x.As <Highlight>())); } var filters_node = node.Element(XmlTag.Filters); if (filters_node != null) { Filters.AddRange(filters_node.Elements(XmlTag.Filter).Select(x => x.As <Filter>())); } var transforms_node = node.Element(XmlTag.Transforms); if (transforms_node != null) { Transforms.AddRange(transforms_node.Elements(XmlTag.Transform).Select(x => x.As <Transform>())); } var actions_node = node.Element(XmlTag.ClkActions); if (actions_node != null) { Actions.AddRange(actions_node.Elements(XmlTag.ClkAction).Select(x => x.As <ClkAction>())); } }
async void GetHighlights() { try { var hightlights = await InstaApi.StoryProcessor.GetHighlightFeedsAsync(UserShort.Pk); if (hightlights.Succeeded) { Highlights.Clear(); if (hightlights.Value?.Items?.Count > 0) { Highlights.AddRange(hightlights.Value.Items); HighlightsVisibility = Visibility.Visible; try { // ehyanan az inja nist?:| await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var users = new List <string>(); foreach (var item in hightlights.Value.Items.Take(5)) { users.Add(item.HighlightId); } var highlightsAfterResult = await InstaApi.StoryProcessor.GetUsersStoriesAsHighlightsAsync(users.ToArray()); if (highlightsAfterResult.Succeeded) { var highlightsAfter = highlightsAfterResult.Value.Items; foreach (var item in Highlights) { try { var single = highlightsAfter.SingleOrDefault(ss => ss.Id == item.HighlightId); if (single != null) { item.Items.Clear(); item.Items.AddRange(single.Items); } } catch { } } } }); } catch { } } else { HighlightsVisibility = Visibility.Collapsed; } TVChannel = hightlights.Value.TVChannel; if (hightlights.Value.TVChannel != null) { IGTVVisibility = Visibility.Visible; } else { IGTVVisibility = Visibility.Collapsed; } } } catch { } }