示例#1
0
        public async Task <IeeeXploreSearchQuery> GetSearchQueryIeeeXplore(string query, CancellationTokenSource cts = null)
        {
            string webPageSource  = null;
            string webPageSource2 = null;

            try
            {
                string url = String.Format(_resources["SearchQueryIeeeXplore"].ToString(), query);
                webPageSource = await GetWebPageSource(url, cts);

                webPageSource2 = webPageSource.ToString();
                return(XmlSerialize <IeeeXploreSearchQuery> .DeserializeXml(webPageSource));
            }
            catch (TaskCanceledException)
            {
                throw;
            }
            catch (Exception)
            {
                if (webPageSource != null && !webPageSource.Equals(webPageSource2))
                {
                    Messenger.Default.Send(new ExceptionToSettingsMessage
                    {
                        Exception = ViewModelLocator.Instance.Settings,
                        Source    = "IEEE Xplore",
                    });
                }
                else
                {
                    throw;
                }
                return(null);
            }
        }
示例#2
0
        public async Task <IeeeXploreSearchQuery> GetPreviousOrNextResultIeeeXplore(string query, int start, CancellationTokenSource cts = null)
        {
            try
            {
                string url           = String.Format(_resources["IeeeXplorePreviousOrNextPageResult"].ToString(), query, start);
                string webPageSource = await GetWebPageSource(url, cts);

                return(XmlSerialize <IeeeXploreSearchQuery> .DeserializeXml(webPageSource));
            }
            catch (TaskCanceledException)
            {
                throw;
            }
            catch (Exception)
            {
                return(null);
            }
        }