//******************************************************************************************************************************
    //
    //      FUNCTIONS
    //
    //******************************************************************************************************************************

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  This is called before Startup().
    /// </summary>
    private void Awake()
    {
        // Initialize singleton
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        Instance = this;

        // Create lists
        _Messages = new List <MatchFeedObject>();
    }
        private void TryGetOnlineFeeds(HtmlNode document, MatchDetails matchDetails)
        {
            var sw = new Stopwatch();

            sw.Start();
            try
            {
                var article =
                    document.Descendants("article")
                    .FirstOrDefault(x => x.Attributes.Contains("class") && x.Attributes["class"].Value == "online-match");
                if (article != null)
                {
                    var element = article.Descendants("ul").FirstOrDefault(x => x.Attributes.Contains("class") && x.Attributes["class"].Value == "online-list");
                    if (element != null)
                    {
                        Debug.WriteLine("Find node: " + sw.Elapsed);
                        var matchFeeds = new List <MatchFeed>();
                        foreach (var htmlNode in element.Descendants("li"))
                        {
                            var swFeed = new Stopwatch();
                            swFeed.Start();
                            var feed = new MatchFeed();
                            var time = htmlNode.Descendants("p").FirstOrDefault(x => x.Attributes.Contains("class") && x.Attributes["class"].Value == "time");
                            if (time != null)
                            {
                                feed.Time = HtmlUtilities.ConvertToText(time.InnerText).Trim();
                            }

                            var text = htmlNode.Descendants("div").FirstOrDefault(x => x.Attributes.Contains("class") && x.Attributes["class"].Value.StartsWith("text "));
                            if (text != null)
                            {
                                var innerHtml = text.InnerHtml;
                                if (innerHtml.StartsWith("<div>\r\n"))
                                {
                                    innerHtml = innerHtml.Remove(5, 2);

                                    if (innerHtml.EndsWith("\r\n") && innerHtml.Length - 3 > 0)
                                    {
                                        innerHtml = innerHtml.Substring(0, innerHtml.Length - 3);
                                    }
                                }

                                feed.TextFeed.Text = HtmlUtilities.ConvertToText(innerHtml.Replace("\t", ""));

                                var className = text.Attributes.FirstOrDefault(x => x.Value.StartsWith("text "));
                                if (className != null)
                                {
                                    feed.TextFeed.ClassName = className.Value;
                                }
                            }

                            var icon =
                                htmlNode.Descendants("p")
                                .FirstOrDefault(
                                    x =>
                                    x.Attributes.Contains("class") &&
                                    x.Attributes["class"].Value.StartsWith("icon"));
                            if (icon != null)
                            {
                                var iconNode = icon.Attributes.FirstOrDefault(x => x.Value.StartsWith("icon"));
                                if (iconNode != null)
                                {
                                    feed.Icon = "ms-appx://" + this.GetIconImageFromIconClassName(iconNode.Value.Trim());
                                }
                            }
                            matchFeeds.Add(feed);

                            Debug.WriteLine("swFeed: " + swFeed.Elapsed);
                        }

                        if (matchFeeds.Any())
                        {
                            matchDetails.MatchFeeds = matchFeeds;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            Debug.WriteLine("Parse feeds: " + sw.Elapsed);
        }