private static List <VideoGuideItem> GetVideoGuidesAll()
        {
            var url = CommonLinkUtility.GetHelpLink();

            if (string.IsNullOrEmpty(url))
            {
                return(new List <VideoGuideItem>());
            }

            url += "video.aspx";

            var storageData = VideoGuideStorage.GetVideoGuide();

            if (storageData == null)
            {
                return(new List <VideoGuideItem>());
            }

            VideoGuideData videoGuideData = null;

            if (storageData.ContainsKey(url))
            {
                videoGuideData = storageData[url];
            }
            if (videoGuideData != null && string.CompareOrdinal(videoGuideData.ResetCacheKey, ClientSettings.ResetCacheKey) != 0)
            {
                videoGuideData = null;
            }

            if (videoGuideData == null)
            {
                var html = SendRequest(url);
                var data = ParseVideoGuideHtml(html);

                videoGuideData = new VideoGuideData {
                    ListItems = new List <VideoGuideItem>()
                };
                if (data.Any())
                {
                    videoGuideData.ListItems     = data;
                    videoGuideData.ResetCacheKey = ClientSettings.ResetCacheKey;

                    storageData[url] = videoGuideData;
                    VideoGuideStorage.UpdateVideoGuide(storageData);
                }
            }

            return(videoGuideData.ListItems);
        }
Beispiel #2
0
        private static List <VideoGuideItem> GetVideoGuidesAll()
        {
            var url = CommonLinkUtility.GetHelpLink(true) + "video.aspx";

            VideoGuideData videoGuideData = null;

            var storageData = VideoGuideStorage.GetVideoGuide() ?? new Dictionary <string, VideoGuideData>();

            if (storageData.ContainsKey(url))
            {
                videoGuideData = storageData[url];
            }

            if (videoGuideData != null && String.CompareOrdinal(videoGuideData.ResetCacheKey, ClientSettings.ResetCacheKey) != 0)
            {
                videoGuideData = null;
            }

            if (videoGuideData == null)
            {
                var html = SendRequest(url);
                var data = ParseVideoGuideHtml(html);

                videoGuideData = new VideoGuideData();
                if (data.Any())
                {
                    videoGuideData.ListItems     = data;
                    videoGuideData.ResetCacheKey = ClientSettings.ResetCacheKey;

                    storageData.Remove(url);
                    storageData.Add(url, videoGuideData);
                    VideoGuideStorage.UpdateVideoGuide(storageData);
                }
            }

            return(videoGuideData.ListItems ?? new List <VideoGuideItem>());
        }