コード例 #1
0
        public void SimpleTest()
        {
            //var sd = new StringDownloader("http://www.chrylers.com/cherrytomato/versionhistory.xml", DisplayResult);
            var sd = new StringDownloader("http://localhost", DisplayResult);

            sd.Run();
            Thread.Sleep(10000);
            Debug.WriteLine("Test stopped.");
        }
コード例 #2
0
        public async Task SendSearchQueryAsync(string query)
        {
            int resultLimit = PreferenceManager.GetSearchResultLimit();

            string address = String.Format(Strings.formatSearchURL, query, resultLimit, Strings.youtubeDeveloperKey);
            string result  = await StringDownloader.GetString(address);

            Log.D(Strings.Tags.MAIN_FORM, "Query  : " + query);

            SearchResultForm resultForm = new SearchResultForm();

            resultForm.SetQuery(HttpUtility.UrlDecode(query));
            resultForm.SetResultJSON(result);
            resultForm.SetDownloadCompletionContext(this);
            resultForm.ShowDialog();
        }
コード例 #3
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (DownloadedString != null)
            {
                FileNameProvided.Invoke(FileName.Text, DownloadedString);
                return;
            }

            var currentUrl = WebsiteUrl.Text;

            await Task.Run(async() =>
            {
                var webClient        = new WebClient();
                var downloadedString = await webClient.DownloadStringTaskAsync(currentUrl);

                Application.Current.Dispatcher.Invoke(() =>
                {
                    DisplayText.Text = "Success!";
                });
                StringDownloader.Invoke(downloadedString);
            });
        }