Пример #1
0
        /// <summary>
        /// Starts the track link.
        /// </summary>
        /// <param name="link">The link.</param>
        private static void StartTrackLink(HyperlinkEx link)
        {
            var key = link.Key;

            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            if (!trackingLinks.ContainsKey(key))
            {
                var storage = new List <HyperlinkEx> {
                    link
                };
                trackingLinks.Add(key, storage);
            }
            else
            {
                var storage = trackingLinks[key];
                if (!storage.Contains(link))
                {
                    storage.Add(link);
                }
            }

            if (visitedLinks.Contains(key))
            {
                link.Foreground = visitedBrush;
            }
        }
Пример #2
0
        /// <summary>
        /// Ends the track link.
        /// </summary>
        /// <param name="link">The link.</param>
        private static void EndTrackLink(HyperlinkEx link)
        {
            var key = link.Key;

            if (string.IsNullOrEmpty(key) || !trackingLinks.ContainsKey(key))
            {
                return;
            }
            var storage = trackingLinks[key];

            if (storage.Contains(link))
            {
                storage.Remove(link);
            }

            if (storage.Count == 0)
            {
                trackingLinks.Remove(key);
            }
        }