public static async Task <string> Get(string uri) { HttpClient httpClient = new HttpClient(); Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = "正在加载..."; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 60; progressIndicator.Show(); var headers = httpClient.DefaultRequestHeaders; headers.UserAgent.ParseAdd("ie"); headers.UserAgent.ParseAdd("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"); try { HttpResponseMessage response = new HttpResponseMessage(); response = await httpClient.GetAsync(new Uri(uri, UriKind.Absolute)); response.EnsureSuccessStatusCode(); responseString = await response.Content.ReadAsStringAsync(); } catch (Exception ex) { } progressIndicator.Hide(); return(responseString); }
public static void Show(string text) { Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = text; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 60; progressIndicator.Show(); }
public static void Show(string text) { Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = text; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 60; progressIndicator.Show(); }
private void donate_Click(object sender, RoutedEventArgs e) { Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = "本应用永久免费无广告,如果您愿意支持我的话.可以向我的支付宝捐赠:15809188214 收款人:康凯森.请注明WP用户捐赠!十分感谢!欢迎关注我的新浪微博:编程小梦"; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 200; progressIndicator.Show(); }
public static async Task<string> Get(string uri) { HttpClient httpClient = new HttpClient(); Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = "正在加载..."; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 60; progressIndicator.Show(); var headers = httpClient.DefaultRequestHeaders; headers.UserAgent.ParseAdd("ie"); headers.UserAgent.ParseAdd("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"); try { HttpResponseMessage response = new HttpResponseMessage(); response = await httpClient.GetAsync(new Uri(uri,UriKind.Absolute)); response.EnsureSuccessStatusCode(); responseString = await response.Content.ReadAsStringAsync(); } catch (Exception ex) { } progressIndicator.Hide(); return responseString; }
private void donate_Click(object sender, RoutedEventArgs e) { Myprogress.ProgressIndicator progressIndicator = new Myprogress.ProgressIndicator(); progressIndicator.Text = "本应用永久免费无广告,如果您愿意支持我的话.可以向我的支付宝捐赠:15809188214 收款人:康凯森.请注明WP用户捐赠!十分感谢!欢迎关注我的新浪微博:编程小梦"; progressIndicator.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x23, 0xAC, 0x5B)); progressIndicator.Width = 400; progressIndicator.Height = 200; progressIndicator.Show(); }