private async void UserControl_Loaded(object sender, RoutedEventArgs e) { JObject json = JObject.Parse(await Uuuhh.GetWebAsync("http://59.37.96.220/soso/fcgi-bin/dynamic_content?format=json&outCharset=utf-8", Encoding.UTF8)); textBox.Text = json["data"]["search_content"].ToString(); RotateTransform rtf = new RotateTransform();// { CenterX = 0.5,CenterY = 0.5}; os.RenderTransform = rtf; os.RenderTransformOrigin = new Point(0.5, 0.5); DoubleAnimation dbAscending = new DoubleAnimation(0, 360, new Duration(TimeSpan.FromSeconds(5))) { RepeatBehavior = RepeatBehavior.Forever }; rtf.BeginAnimation(RotateTransform.AngleProperty, dbAscending); listBox.Items.Clear(); ListJson lj = new Lemon_App.ListJson(); lj = JsonToObject(Settings.Default.MusicList, lj) as ListJson; for (int i = 0; i < lj.List.Count; i++) { listBox.Items.Add(new MusicItemControl() { MusicGS = lj.List[i].ItemText[3], MusicName = lj.List[i].ItemText[1], MusicZJ = lj.List[i].ItemText[5], Music = lj.List[i].ItemText }); } }
private async void label_MouseDown(object sender, MouseButtonEventArgs e) { JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://www.tuling123.com/openapi/api?key=0651b32a3a6c8f54c7869b9e62872796&info=" + Uri.EscapeUriString(textBox1.Text) + "&userid=" + Uri.EscapeUriString(Settings.Default.LemonAreeunIts))); User U = new User(textBox1.Text) { Width = Robot.ActualWidth }; Robot Rb = new Robot((string)obj["text"]) { Width = Robot.ActualWidth }; Robot.Children.Add(U); Robot.Children.Add(Rb); if ((string)obj["code"] == "200000") { string i = (string)obj["text"]; User Uu = new User(textBox1.Text); U.Width = Robot.ActualWidth; Lemon_App.Robot Rbu = new Lemon_App.Robot((string)obj["url"] + i); Rb.Width = Robot.ActualWidth; Robot.Children.Add(Uu); Robot.Children.Add(Rbu); } }
private async void textBlock2_MouseDown(object sender, MouseButtonEventArgs e) { try { h.Visibility = Visibility.Visible; G.Visibility = Visibility.Hidden; ZjImAgE.Visibility = Visibility.Collapsed; ioi++; listBox.Items.Clear(); JObject o = JObject.Parse(await Uuuhh.GetWebAsync($"http://s.music.qq.com/fcgi-bin/music_search_new_platform?t=0&n=50&aggr=1&cr=1&loginUin={Settings.Default.RobotName}&format=json&inCharset=GB2312&outCharset=utf-8¬ice=0&platform=jqminiframe.json&needNewCode=0&p={ioi.ToString()}&catZhida=0&remoteplace=sizer.newclient.next_song&w={Uri.EscapeDataString(textBox.Text)}")); int i = 0; while (i < 50) { string f = o["data"]["song"]["list"][i]["f"].ToString().Replace("|", "\r\n"); string[] ContentLines = f.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); string Gs = o["data"]["song"]["list"][i]["fsinger"].ToString(); string songname = o["data"]["song"]["list"][i]["fsong"].ToString(); string Zhj = o["data"]["song"]["list"][i]["albumName_hilight"].ToString(); // img = ContentLines[22]; listBox.Items.Add(new MusicItemControl() { BorderThickness = new Thickness(0), MusicGS = Gs, MusicName = songname, MusicZJ = Zhj, Music = ContentLines }); i++; } } catch { } }
private async void Border_MouseDown_2(object sender, MouseButtonEventArgs e) { try { if (BingimageMS > 0) { BingimageMS--; obj = JObject.Parse(await Uuuhh.GetWebAsync($"http://www.bing.com/HPImageArchive.aspx?format=js&idx={BingimageMS}&n=1&mkt=zh-CN")); string url = "http://cn.bing.com" + obj["images"][0]["url"].ToString(); if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.GetFileNameWithoutExtension(url))) { WebClient dc = new WebClient() { Proxy = He.proxy }; dc.DownloadFileCompleted += Fi; dc.DownloadFileAsync(new Uri(url), AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.GetFileNameWithoutExtension(url)); // bingDailyPicture.Background = new ImageBrush(new BitmapImage(new Uri(url))); } else { Fi(null, null); } } } catch { } }
private async void NaAsync(object sender, WebBrowserNavigatedEventArgs e) { if (index != 0) { if (wb.DocumentTitle == "我的QQ中心") { op.IsOpen = false; var qq = He.Text(wb.Document.Cookie, "uin=o", ";", 0); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + qq + @"@qq.com.st")) { He.Settings = (SettingsData)JSON.JsonToObject(Encoding.Default.GetString(Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + qq + @"@qq.com.st"), FanyiBox.MD5.EncryptToMD5string(qq + "@qq.com.st")))), He.Settings); } else { He.SaveSettings(qq + "@qq.com"); } var sl = He.Text(await Uuuhh.GetWebAsync("http://r.pengyou.com/fcg-bin/cgi_get_portrait.fcg?uins=" + qq, Encoding.Default), "portraitCallBack(", ")", 0); JObject o = JObject.Parse(sl); try { await Uuuhh.HttpDownloadFileAsync($"http://q2.qlogo.cn/headimg_dl?bs=qq&dst_uin={qq}&spec=100", AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg"); var image = new System.Drawing.Bitmap(AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg"); TX.Background = new ImageBrush(image.ToImageSource()); } catch { } He.Settings.RobotName = o[qq][6].ToString(); He.Settings.UserImage = AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg"; He.Settings.LemonAreeunIts = qq + "@qq.com"; He.Settings.RNBM = (Boolean)RM.IsChecked; He.SaveSettings(); He.lsd.NAME = qq; He.lsd.RNBM = (Boolean)RM.IsChecked; He.lsd.TX = AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg"; He.SaveLoadSettings(); (Resources["OnLoaded1"] as Storyboard).Begin(); tr.Start(); } else if (wb.DocumentText.Contains("安全验证")) { op.IsOpen = true; rk.Text = "请输入验证码"; } else { rk.Text = "登录失败,请检查账号和密码."; op.IsOpen = false; } } else { index++; } }
private async Task LoadapisAsync(string ha = "最新") { WP.Children.Clear(); JObject o = JObject.Parse(await Uuuhh.GetWebAsync($"https://route.showapi.com/109-35?&page=1&showapi_sign=cfa206656db244c089be2d1499735bb5&showapi_appid=29086&maxResult=100&channelName={ha}")); int i = 0; while (i != 100) { WP.Children.Add(new NewsList(o["showapi_res_body"]["pagebean"]["contentlist"][i]["title"].ToString(), o["showapi_res_body"]["pagebean"]["contentlist"][i]["pubDate"].ToString(), o["showapi_res_body"]["pagebean"]["contentlist"][i]["source"].ToString(), "", o["showapi_res_body"]["pagebean"]["contentlist"][i]["link"].ToString())); i++; } }
private async void Grid_Loaded(object sender, RoutedEventArgs e) { try { JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN")); string url = "http://cn.bing.com" + obj["images"][0]["url"].ToString(); bingDailyPicture.Source = new BitmapImage(new Uri(url)); textBlock.Text = obj["images"][0]["copyright"].ToString(); downuri = obj["images"][0]["copyrightlink"].ToString(); BingimageMS = 0; } catch { } }
private async void FanyiFromtoTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (!Uuuhh.Lalala("www.mi.com")) { textBlock.Text = "无法连接到互联网!"; } else { string o = await Uuuhh.GetWebAsync("http://dict-co.iciba.com/api/dictionary.php?w=" + Uri.EscapeUriString(textBox1.Text) + "&key=04C75B1C14FAEA63A0DDA93FE527EA0A"); textBlock.Text = "vi." + 取出中间文本(o, "<acceptation>", "</acceptation>", 0) + "\r\n" + 取出中间文本(o, "<sent><orig>", "</orig>", 0) + 取出中间文本(o, "<trans>", "</trans></sent>", 0); } }
private async void Border_MouseDown_2(object sender, MouseButtonEventArgs e) { try { if (BingimageMS > 0) { BingimageMS--; JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN")); string url = "http://cn.bing.com" + obj["images"][0]["url"].ToString(); bingDailyPicture.Source = new BitmapImage(new Uri(url)); textBlock.Text = obj["images"][0]["copyright"].ToString(); downuri = obj["images"][0]["copyrightlink"].ToString(); } } catch { } }
private async void button_Cli(object sender, MouseButtonEventArgs e) { if (textBox1.Text != "") { Fx(); string q = Uri.EscapeDataString(textBox1.Text); string sign = MD5.EncryptToMD5string("20151231000008489" + textBox1.Text + "2004112629Q3EQP1ay2cLKAMxs2gqa"); try { string o = "http://api.fanyi.baidu.com/api/trans/vip/translate?q=" + q + "&from=" + from + "&to=" + to + "&appid=20151231000008489&salt=2004112629" + "&sign=" + sign; JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://api.fanyi.baidu.com/api/trans/vip/translate?q=" + q + "&from=" + from + "&to=" + to + "&appid=20151231000008489&salt=2004112629" + "&sign=" + sign)); FanyiFromtoTextBox.Text = DecodeUtf8(obj["trans_result"][0]["dst"].ToString()); } catch { } } }
private async void Grid_Loaded(object sender, RoutedEventArgs e) { try { obj = JObject.Parse(await Uuuhh.GetWebAsync("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN")); string url = "http://cn.bing.com" + obj["images"][0]["url"].ToString(); if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.GetFileNameWithoutExtension(url))) { WebClient dc = new WebClient() { Proxy = He.proxy }; dc.DownloadFileCompleted += Fi; dc.DownloadFileAsync(new Uri(url), AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.GetFileNameWithoutExtension(url)); } else { Fi(null, null); } BingimageMS = 0; } catch { } }
private async void button_Cli(object sender, MouseButtonEventArgs e) { if (textBox1.Text != "") { string q = Uri.EscapeDataString(textBox1.Text); string from = "auto"; string to = "zh"; string sign = MD5.EncryptToMD5string("20151231000008489" + textBox1.Text + "2004112629Q3EQP1ay2cLKAMxs2gqa"); if (Yyycombo.Text == "自动") { from = "auto"; } if (Yyycombo.Text == "中文") { from = "zh"; } if (Yyycombo.Text == "粤语") { from = "yue"; } if (Yyycombo.Text == "英语") { from = "en"; } if (Yyycombo.Text == "文言文") { from = "wyw"; } if (Yyycombo.Text == "日语") { from = "jp"; } if (Yyycombo.Text == "韩语") { from = "kor"; } if (Yyycombo.Text == "法语") { from = "fra"; } if (Yyycombo.Text == "西班牙语") { from = "spa"; } if (Yyycombo.Text == "俄语") { from = "ru"; } if (Yyycombo.Text == "泰语") { from = "th"; } if (Yyycombo.Text == "阿拉伯语") { from = "ara"; } if (Yyycombo.Text == "德语") { from = "de"; } if (Yyycombo.Text == "意大利语") { from = "it"; } if (Yyycombo.Text == "希腊语") { from = "el"; } if (Yyycombo.Text == "荷兰语") { from = "nl"; } if (Yyycombo.Text == "波兰语") { from = "pl"; } if (Yyycombo.Text == "保加利亚语") { from = "bul"; } if (Yyycombo.Text == "爱沙尼亚语") { from = "auto"; } if (Yyycombo.Text == "丹麦语") { from = "dan"; } if (Yyycombo.Text == "芬兰语") { from = "fin"; } if (Yyycombo.Text == "捷克语") { from = "cs"; } if (Yyycombo.Text == "罗马尼亚语") { from = "rom"; } if (Yyycombo.Text == "斯洛文尼亚语") { from = "slo"; } if (Yyycombo.Text == "瑞典语") { from = "swe"; } if (Yyycombo.Text == "匈牙利语") { from = "hu"; } if (Yyycombo.Text == "繁体中文") { from = "cht"; } if (HyycomboBox.Text == "中文") { to = "zh"; } if (HyycomboBox.Text == "粤语") { to = "yue"; } if (HyycomboBox.Text == "英语") { to = "en"; } if (HyycomboBox.Text == "文言文") { to = "wyw"; } if (HyycomboBox.Text == "日语") { to = "jp"; } if (HyycomboBox.Text == "韩语") { to = "kor"; } if (HyycomboBox.Text == "法语") { to = "fra"; } if (HyycomboBox.Text == "西班牙语") { to = "spa"; } if (HyycomboBox.Text == "俄语") { to = "ru"; } if (HyycomboBox.Text == "泰语") { to = "th"; } if (HyycomboBox.Text == "阿拉伯语") { to = "ara"; } if (HyycomboBox.Text == "德语") { to = "de"; } if (HyycomboBox.Text == "意大利语") { to = "it"; } if (HyycomboBox.Text == "希腊语") { to = "el"; } if (HyycomboBox.Text == "荷兰语") { to = "nl"; } if (HyycomboBox.Text == "波兰语") { to = "pl"; } if (HyycomboBox.Text == "保加利亚语") { to = "bul"; } if (HyycomboBox.Text == "爱沙尼亚语") { to = "auto"; } if (HyycomboBox.Text == "丹麦语") { to = "dan"; } if (HyycomboBox.Text == "芬兰语") { to = "fin"; } if (HyycomboBox.Text == "捷克语") { to = "cs"; } if (HyycomboBox.Text == "罗马尼亚语") { to = "rom"; } if (HyycomboBox.Text == "斯洛文尼亚语") { to = "slo"; } if (HyycomboBox.Text == "瑞典语") { to = "swe"; } if (HyycomboBox.Text == "匈牙利语") { to = "hu"; } if (HyycomboBox.Text == "繁体中文") { to = "cht"; } try { string o = "http://api.fanyi.baidu.com/api/trans/vip/translate?q=" + q + "&from=" + from + "&to=" + to + "&appid=20151231000008489&salt=2004112629" + "&sign=" + sign; JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://api.fanyi.baidu.com/api/trans/vip/translate?q=" + q + "&from=" + from + "&to=" + to + "&appid=20151231000008489&salt=2004112629" + "&sign=" + sign)); FanyiFromtoTextBox.Text = DecodeUtf8(obj["trans_result"][0]["dst"].ToString()); } catch { } } }
private async void GetWeather(string i) {//V5 //Now实况天气 try { grid.BeginAnimation(MarginProperty, new ThicknessAnimation(new Thickness(0, 20, 0, -20), new Thickness(0), TimeSpan.FromSeconds(0.2))); //空气质量 JObject p = JObject.Parse(await Uuuhh.GetWebAsync($"https://route.showapi.com/104-29?showapi_sign=cfa206656db244c089be2d1499735bb5&showapi_appid=29086&city={Uri.EscapeUriString(i)}")); kqzl.Text = p["showapi_res_body"]["pm"]["quality"] + " " + p["showapi_res_body"]["pm"]["aqi"]; JObject obj = JObject.Parse(await Uuuhh.GetWebAsync($"https://free-api.heweather.com/v5/now?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); Biaoti.Text = "天气预报•" + obj["HeWeather5"][0]["basic"]["city"]; Qiwen.Text = obj["HeWeather5"][0]["now"]["tmp"] + "°"; Tianqi.Text = obj["HeWeather5"][0]["now"]["cond"]["txt"] + " 相对湿度 " + obj["HeWeather5"][0]["now"]["hum"] + "% 体感:" + obj["HeWeather5"][0]["now"]["fl"] + "°"; fengsu.Text = obj["HeWeather5"][0]["now"]["wind"]["dir"] + " " + obj["HeWeather5"][0]["now"]["wind"]["sc"] + "级"; allqiyanjd.Text = "气压:" + obj["HeWeather5"][0]["now"]["pres"] + " 能见度" + obj["HeWeather5"][0]["now"]["vis"]; Icon.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj["HeWeather5"][0]["now"]["cond"]["code"]}.png"))) { Stretch = Stretch.UniformToFill }; //7天天气预报 JObject obj1 = JObject.Parse(await Uuuhh.GetWebAsync($"https://free-api.heweather.com/v5/forecast?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); //Icon图标 iconw.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][0]["cond"]["code_d"]}.png")); iconww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][1]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; iconwww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][2]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; iconwwww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][3]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; iconwwwww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][4]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; iconwwwwww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][5]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; iconwwwwwww.Background = new ImageBrush(new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][6]["cond"]["code_d"]}.png"))) { Stretch = Stretch.UniformToFill }; //时间 shijianw.Text = obj1["HeWeather5"][0]["daily_forecast"][0]["date"].ToString(); shijianww.Text = obj1["HeWeather5"][0]["daily_forecast"][1]["date"].ToString(); shijianwww.Text = obj1["HeWeather5"][0]["daily_forecast"][2]["date"].ToString(); shijianwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][3]["date"].ToString(); shijianwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][4]["date"].ToString(); shijianwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][5]["date"].ToString(); shijianwwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][6]["date"].ToString(); //气温:最高/最低 qiwenw.Text = obj1["HeWeather5"][0]["daily_forecast"][0]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][0]["tmp"]["min"] + "°"; qiwenww.Text = obj1["HeWeather5"][0]["daily_forecast"][1]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][1]["tmp"]["min"] + "°"; qiwenwww.Text = obj1["HeWeather5"][0]["daily_forecast"][2]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][2]["tmp"]["min"] + "°"; qiwenwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][3]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][3]["tmp"]["min"] + "°"; qiwenwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][4]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][4]["tmp"]["min"] + "°"; qiwenwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][5]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][5]["tmp"]["min"] + "°"; qiwenwwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][6]["tmp"]["max"] + "℃-" + obj1["HeWeather5"][0]["daily_forecast"][6]["tmp"]["min"] + "°"; } catch { Erro.BeginAnimation(HeightProperty, new DoubleAnimation(0, 37, TimeSpan.FromSeconds(0.2))); } }
private async void label_MouseDown(object sender, MouseButtonEventArgs e) { try { JObject obj = JObject.Parse(await Uuuhh.GetWebAsync("http://www.tuling123.com/openapi/api?key=0651b32a3a6c8f54c7869b9e62872796&info=" + Uri.EscapeUriString(textBox1.Text) + "&userid=" + Uri.EscapeUriString(He.Settings.LemonAreeunIts))); if ((string)obj["code"] == "100000" || obj["code"].ToString() == "40002") { User U = new User(textBox1.Text) { Width = Robot.ActualWidth, Opacity = 0 }; Robot Rb = new Robot((string)obj["text"]) { Width = Robot.ActualWidth, Opacity = 0 }; Robot.Children.Add(U); Robot.Children.Add(Rb); var b = new DoubleAnimation(1, TimeSpan.FromSeconds(0.2)); U.BeginAnimation(OpacityProperty, b); Rb.BeginAnimation(OpacityProperty, b); } else if ((string)obj["code"] == "200000") { string i = (string)obj["text"]; User Uu = new User(textBox1.Text) { Opacity = 0, Width = Robot.ActualWidth }; Lemon_App.Robot Rbu = new Lemon_App.Robot((string)obj["url"] + i) { Opacity = 0, Width = Robot.ActualWidth, ToolTip = (string)obj["url"].ToString() }; Rbu.MouseDown += Rbu_MouseDown; Robot.Children.Add(Uu); Robot.Children.Add(Rbu); var b = new DoubleAnimation(1, TimeSpan.FromSeconds(0.2)); Uu.BeginAnimation(OpacityProperty, b); Rbu.BeginAnimation(OpacityProperty, b); } else if ((string)obj["code"] == "308000") { User Uu = new User(textBox1.Text) { Width = Robot.ActualWidth, Opacity = 0 }; Robot.Children.Add(Uu); int i = 0; var s = new List <string>(); var f = new List <string>(); var u = new List <string>(); while (i != 5) { s.Add(obj["list"][i]["name"].ToString()); f.Add(obj["list"][i]["info"].ToString()); u.Add(obj["list"][i]["detailurl"].ToString()); i++; } var c = new RobotHrSp(s, f, u) { Width = Robot.ActualWidth, Opacity = 0 }; Robot.Children.Add(c); var b = new DoubleAnimation(1, TimeSpan.FromSeconds(0.2)); Uu.BeginAnimation(OpacityProperty, b); c.BeginAnimation(OpacityProperty, b); } } catch { User U = new User(textBox1.Text) { Width = Robot.ActualWidth , Opacity = 0 }; Robot Rb = new Robot("小萌机器人似乎遇到了些问题") { Width = Robot.ActualWidth, Opacity = 0 }; Robot.Children.Add(U); Robot.Children.Add(Rb); var b = new DoubleAnimation(1, TimeSpan.FromSeconds(0.2)); U.BeginAnimation(OpacityProperty, b); Rb.BeginAnimation(OpacityProperty, b); } textBox1.Text = ""; }
private async void GetWeather(string i) {//V5 //Now实况天气 try {//空气质量 JObject p = JObject.Parse(await Uuuhh.GetWebAsync($"https://route.showapi.com/104-29?showapi_sign=cfa206656db244c089be2d1499735bb5&showapi_appid=29086&city={Uri.EscapeUriString(i)}")); kqzl.Text = "空气质量: " + p["showapi_res_body"]["pm"]["quality"] + " " + p["showapi_res_body"]["pm"]["aqi"]; JObject obj = JObject.Parse(await Uuuhh.GetWebAsync($"https://api.heweather.com/v5/now?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); Biaoti.Text = "天气预报•" + obj["HeWeather5"][0]["basic"]["city"]; Qiwen.Text = obj["HeWeather5"][0]["now"]["tmp"] + "°"; Tianqi.Text = obj["HeWeather5"][0]["now"]["cond"]["txt"] + " 相对湿度 " + obj["HeWeather5"][0]["now"]["hum"] + "% 体感:" + obj["HeWeather5"][0]["now"]["fl"] + "°"; fengsu.Text = obj["HeWeather5"][0]["now"]["wind"]["dir"] + " " + obj["HeWeather5"][0]["now"]["wind"]["sc"] + "级"; allqiyanjd.Text = "气压:" + obj["HeWeather5"][0]["now"]["pres"] + " 能见度" + obj["HeWeather5"][0]["now"]["vis"]; Icon.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj["HeWeather5"][0]["now"]["cond"]["code"]}.png")); //7天天气预报 JObject obj1 = JObject.Parse(await Uuuhh.GetWebAsync($"https://api.heweather.com/v5/forecast?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); //Icon图标 iconw.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][0]["cond"]["code_d"]}.png")); iconww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][1]["cond"]["code_d"]}.png")); iconwww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][2]["cond"]["code_d"]}.png")); iconwwww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][3]["cond"]["code_d"]}.png")); iconwwwww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][4]["cond"]["code_d"]}.png")); iconwwwwww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][5]["cond"]["code_d"]}.png")); iconwwwwwww.Source = new BitmapImage(new Uri($"http://files.heweather.com/cond_icon/{obj1["HeWeather5"][0]["daily_forecast"][6]["cond"]["code_d"]}.png")); //时间 shijianw.Text = obj1["HeWeather5"][0]["daily_forecast"][0]["date"].ToString(); shijianww.Text = obj1["HeWeather5"][0]["daily_forecast"][1]["date"].ToString(); shijianwww.Text = obj1["HeWeather5"][0]["daily_forecast"][2]["date"].ToString(); shijianwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][3]["date"].ToString(); shijianwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][4]["date"].ToString(); shijianwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][5]["date"].ToString(); shijianwwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][6]["date"].ToString(); //气温:最高/最低 qiwenw.Text = obj1["HeWeather5"][0]["daily_forecast"][0]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][0]["tmp"]["min"] + "°"; qiwenww.Text = obj1["HeWeather5"][0]["daily_forecast"][1]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][1]["tmp"]["min"] + "°"; qiwenwww.Text = obj1["HeWeather5"][0]["daily_forecast"][2]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][2]["tmp"]["min"] + "°"; qiwenwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][3]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][3]["tmp"]["min"] + "°"; qiwenwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][4]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][4]["tmp"]["min"] + "°"; qiwenwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][5]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][5]["tmp"]["min"] + "°"; qiwenwwwwwww.Text = obj1["HeWeather5"][0]["daily_forecast"][6]["tmp"]["max"] + "° " + obj1["HeWeather5"][0]["daily_forecast"][6]["tmp"]["min"] + "°"; //降水量 jcglw.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][0]["pcpn"]; jcglww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][1]["pcpn"]; jcglwww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][2]["pcpn"]; jcglwwww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][3]["pcpn"]; jcglwwwww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][4]["pcpn"]; jcglwwwwww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][5]["pcpn"]; jcglwwwwwww.Content = "💧" + obj1["HeWeather5"][0]["daily_forecast"][6]["pcpn"]; //每小时天气 JObject o = JObject.Parse(await Uuuhh.GetWebAsync($"https://api.heweather.com/v5/hourly?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); hourlyTimew.Content = o["HeWeather5"][0]["hourly_forecast"][0]["date"].ToString(); hourlyTimeww.Content = o["HeWeather5"][0]["hourly_forecast"][1]["date"].ToString(); hourlyTimewww.Content = o["HeWeather5"][0]["hourly_forecast"][2]["date"].ToString(); hourlyTimewwww.Content = o["HeWeather5"][0]["hourly_forecast"][3]["date"].ToString(); hourlyTimewwwww.Content = o["HeWeather5"][0]["hourly_forecast"][4]["date"].ToString(); hourlyQww.Content = o["HeWeather5"][0]["hourly_forecast"][0]["tmp"] + "℃"; hourlyQwww.Content = o["HeWeather5"][0]["hourly_forecast"][1]["tmp"] + "℃"; hourlyQwwww.Content = o["HeWeather5"][0]["hourly_forecast"][2]["tmp"] + "℃"; hourlyQwwwww.Content = o["HeWeather5"][0]["hourly_forecast"][3]["tmp"] + "℃"; hourlyQwwwwww.Content = o["HeWeather5"][0]["hourly_forecast"][4]["tmp"] + "℃"; hourlyfsw.Content = "☁" + o["HeWeather5"][0]["hourly_forecast"][0]["wind"]["dir"] + " " + o["HeWeather5"][0]["hourly_forecast"][0]["wind"]["sc"]; hourlyfsww.Content = "☁" + o["HeWeather5"][0]["hourly_forecast"][1]["wind"]["dir"] + " " + o["HeWeather5"][0]["hourly_forecast"][1]["wind"]["sc"]; hourlyfswww.Content = "☁" + o["HeWeather5"][0]["hourly_forecast"][2]["wind"]["dir"] + " " + o["HeWeather5"][0]["hourly_forecast"][2]["wind"]["sc"]; hourlyfswwww.Content = "☁" + o["HeWeather5"][0]["hourly_forecast"][3]["wind"]["dir"] + " " + o["HeWeather5"][0]["hourly_forecast"][3]["wind"]["sc"]; hourlyfswwwww.Content = "☁" + o["HeWeather5"][0]["hourly_forecast"][4]["wind"]["dir"] + " " + o["HeWeather5"][0]["hourly_forecast"][4]["wind"]["sc"]; //生活指数 JObject b = JObject.Parse(await Uuuhh.GetWebAsync($"https://api.heweather.com/v5/suggestion?city={Uri.EscapeUriString(i)}&key=f97e6a6ad4cd49babd0538747c86b88d")); CY.Text = "穿衣指数:" + b["HeWeather5"][0]["suggestion"]["drsg"]["brf"]; CY1.ToolTip = b["HeWeather5"][0]["suggestion"]["drsg"]["txt"].ToString(); ZYX.Text = "紫外线指数:" + b["HeWeather5"][0]["suggestion"]["uv"]["brf"]; ZWX.ToolTip = b["HeWeather5"][0]["suggestion"]["uv"]["txt"].ToString(); XC.Text = "洗车指数:" + b["HeWeather5"][0]["suggestion"]["cw"]["brf"]; XC1.ToolTip = b["HeWeather5"][0]["suggestion"]["cw"]["txt"].ToString(); LY.Text = "旅游指数:" + b["HeWeather5"][0]["suggestion"]["trav"]["brf"]; LY1.ToolTip = b["HeWeather5"][0]["suggestion"]["trav"]["txt"].ToString(); GM.Text = "感冒指数:" + b["HeWeather5"][0]["suggestion"]["flu"]["brf"]; GM1.ToolTip = b["HeWeather5"][0]["suggestion"]["flu"]["txt"].ToString(); YD.Text = "感冒指数:" + b["HeWeather5"][0]["suggestion"]["sport"]["brf"]; YD1.ToolTip = b["HeWeather5"][0]["suggestion"]["sport"]["txt"].ToString(); } catch { } }