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 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 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 { } }
public async void SETMIDAsync(string MID) { this.MID = MID; var s = await Uuuhh.GetWebDatacAsync($"https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg?type=1&json=1&utf8=1&onlysong=0&disstid={MID}&format=json&g_tk=5381&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0", Encoding.UTF8); JObject o = JObject.Parse(s); MIDNAME.Text = o["cdlist"][0]["dissname"].ToString(); MIDIMAGE.Background = new ImageBrush(new BitmapImage(new Uri(o["cdlist"][0]["logo"].ToString()))); }
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 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 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 void textBlock4_MouseDown(object sender, MouseButtonEventArgs e) { DOWN.Visibility = Visibility.Visible; listBox.Visibility = Visibility.Collapsed; string guid = "20D919A4D7700FBC424740E8CED80C6F"; string ioo = Uuuhh.GetWeb($"http://59.37.96.220/base/fcgi-bin/fcg_musicexpress2.fcg?version=12&miniversion=92&key=19914AA57A96A9135541562F16DAD6B885AC8B8B5420AC567A0561D04540172E&guid={guid}"); string vkey = He.Text(ioo, "key=\"", "\" speedrpttype", 0); string uri = $"http://182.247.250.19/streamoc.music.tc.qq.com/M500{musicid}.mp3?vkey={vkey}&guid={guid}"; WebClient dc = new WebClient(); dc.Proxy = He.proxy; dc.DownloadFileAsync(new Uri(uri), AppDomain.CurrentDomain.BaseDirectory + $@"MusicDownload/{textBlock1.Text}.mp3"); dc.DownloadFileCompleted += OK; dc.DownloadProgressChanged += DownloadFileCompleted; }
private async void Window_Loaded(object sender, RoutedEventArgs e) { ZX.BeginAnimation(OpacityProperty, new DoubleAnimation(0.3, 1, TimeSpan.FromSeconds(1)) { AutoReverse = true }); if (await Lemon_Updata.IsLemonNew(He.KMS)) { new UpdataWindow().Show(); } if (!Uuuhh.Lalala("www.mi.com")) { ZX.Background = MIN.Background; } else { ZX.Background = MAX.Background; } if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "UserImage.bmp")) { tx.Background = new ImageBrush(new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "UserImage.bmp", UriKind.Absolute))); } DateTime tmCur = DateTime.Now; if (tmCur.Hour > 18 && tmCur.Hour < 24) { Toast.SetToastNotion("晚上好:", "欢迎回来" + Settings.Default.RobotName, "------早睡早起身体好").Show(); } else if (tmCur.Hour >= 11 && tmCur.Hour < 12) { Toast.SetToastNotion("中午好:", "欢迎回来" + Settings.Default.RobotName, "------中午啦~吃饭饭了~~").Show(); } else if (tmCur.Hour > 1 && tmCur.Hour < 5) { Toast.SetToastNotion("凌晨好:", "欢迎回来" + Settings.Default.RobotName, "-----不乖哦,还没有睡觉~").Show(); } else if (tmCur.Hour > 6 && tmCur.Hour < 11) { Toast.SetToastNotion("早上好:", "欢迎回来" + Settings.Default.RobotName, "-----一日之计在于晨,早上是最宝贵的时间哦~").Show(); } else if (tmCur.Hour > 13 && tmCur.Hour < 17) { Toast.SetToastNotion("下午好:", "欢迎回来" + Settings.Default.RobotName, "------祝你今天好运!").Show(); } LemonWeather w = new LemonWeather(Settings.Default.WeatherInfo); Toast.SetToastNotion($"今日{w.WeatherName}天气", w.WeatherMessage, "-----来自柠檬天气Toast").Show(); }
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 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 Window_Loaded(object sender, RoutedEventArgs e) { BassNet.Registration("*****@*****.**", "2X211223140022"); Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_CPSPEAKERS, new WindowInteropHelper(this).Handle); Rect rc = SystemParameters.WorkArea; this.MaxWidth = rc.Width; this.MaxHeight = rc.Height; IntPtr handle = new WindowInteropHelper(this).Handle; RegisterHotKey(handle, 124, (uint)4, (uint)System.Windows.Forms.Keys.Z); RegisterHotKey(handle, 125, (uint)4, (uint)System.Windows.Forms.Keys.S); RegisterHotKey(handle, 126, (uint)4, (uint)System.Windows.Forms.Keys.X); RegisterHotKey(handle, 127, (uint)4, (uint)System.Windows.Forms.Keys.A); RegisterHotKey(handle, 128, (uint)4, (uint)System.Windows.Forms.Keys.End); RegisterHotKey(handle, 129, (uint)4, (uint)System.Windows.Forms.Keys.Q); InstallHotKeyHook(this); // FontFamily = new FontFamily(".PingFang SC"); Font.Items.Clear(); foreach (FontFamily font in Fonts.SystemFontFamilies) { Font.Items.Add(new ListBoxItem() { Content = font.Source, FontFamily = font }); } new WelcomeWindow().Show(); new HaWindow().Show(); // ZX.BeginAnimation(OpacityProperty, new DoubleAnimation(0.3, 1, TimeSpan.FromSeconds(1)) { AutoReverse = true }); if (await Lemon_Updata.IsLemonNew(He.KMS)) { new UpdataWindow().Show(); } if (!Uuuhh.Lalala("www.mi.com")) { ZX.Background = MIN.Background; } else { ZX.Background = MAX.Background; } if (System.IO.File.Exists(He.Settings.UserImage)) { var image = new System.Drawing.Bitmap(He.Settings.UserImage); tx.Background = new ImageBrush(image.ToImageSource()); } }
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 Task LoadapisAsync(string info = "news_hot") { try { jz.Text = "加载中"; jz.Visibility = Visibility.Visible; var s = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; ass = await Uuuhh.GetWebDataAsync($"https://www.toutiao.com/api/pc/feed/?category={info}&utm_source=toutiao&widen=1&tadrequire=true&max_behot_time={s}&max_behot_time_tmp={s}&as=A1156950D5231C8&cp=59051331BC08CE1", Encoding.UTF8); JObject o = JObject.Parse(ass); int i = 0; while (i++ != 5) { if (o["data"][i].ToString().Contains("广告") == true) { continue; } string title = o["data"][i]["title"].ToString(); string time = He.StampToDateTime(o["data"][i]["behot_time"].ToString()).ToString(); string sousce = o["data"][i]["source"].ToString(); string url = "http://www.toutiao.com" + o["data"][i]["source_url"].ToString(); string text = ""; if (o["data"][i].ToString().Contains("abstract") == true) { text = o["data"][i]["abstract"].ToString(); } WP.Children.Add(new NewsList(title, time, sousce, url, text) { Width = this.ActualWidth }); } jz.Visibility = Visibility.Collapsed; O.BeginAnimation(MarginProperty, new ThicknessAnimation(new Thickness(0, 86, 0, 0), new Thickness(0, 36, 0, 0), TimeSpan.FromSeconds(0.2))); } catch (Exception ex) { jz.Text = "加载失败"; Console.WriteLine(ex.Message); Console.WriteLine(ass); } }
private async void io(object sender, EventArgs e) { // try { s.Data = Geometry.Parse("M2.432,11.997L13.69,1.714c0.393-0.392,0.393-1.028,0-1.42c-0.393-0.392-1.031-0.392-1.424,0L0.286,11.236c-0.21,0.209-0.299,0.487-0.285,0.76c-0.014,0.274,0.075,0.551,0.285,0.76l11.98,10.942c0.393,0.392,1.031,0.392,1.424,0c0.393-0.392,0.393-1.028,0-1.42L2.432,11.997z"); string i = ""; if (listBox.SelectedIndex != listBox.Items.Count) { i = (listBox.Items[listBox.SelectedIndex + 1] as MusicItemControl).Content; listBox.SelectedItem = listBox.Items[listBox.SelectedIndex + 1]; } else { i = (listBox.Items[0] as MusicItemControl).Content; listBox.SelectedItem = listBox.Items[0]; } isR = true; textBlock1.Text = i; lrcname.Text = ((listBox.SelectedItem as MusicItemControl).Music as string[])[1]; zk.Text = ((listBox.SelectedItem as MusicItemControl).Music as string[])[3]; img = ((listBox.SelectedItem as MusicItemControl).Music as string[])[22]; He.on = $"https://y.gtimg.cn/music/photo_new/T002R300x300M000{img}.jpg"; tx.Background = new ImageBrush(new BitmapImage(new Uri(He.on))); musicid = ((listBox.SelectedItem as MusicItemControl).Music as string[])[20]; // if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3")) //{ // musicurl = $"http://cc.stream.qqmusic.qq.com/C100{musicid}.m4a?fromtag=52"; string guid = "20D919A4D7700FBC424740E8CED80C6F"; string ioo = Uuuhh.GetWeb($"http://59.37.96.220/base/fcgi-bin/fcg_musicexpress2.fcg?version=12&miniversion=92&key=19914AA57A96A9135541562F16DAD6B885AC8B8B5420AC567A0561D04540172E&guid={guid}"); string vkey = He.Text(ioo, "key=\"", "\" speedrpttype", 0); musicurl = $"http://182.247.250.19/streamoc.music.tc.qq.com/M500{musicid}.mp3?vkey={vkey}&guid={guid}"; player.Open(new Uri(musicurl)); player.Play(); t.Start(); //WebClient dc = new WebClient() //{ // Proxy = He.proxy //}; //dc.DownloadFileCompleted += Fis; //dc.DownloadFileAsync(new Uri(musicurl), AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3"); /////等待播放 //loading.Visibility = Visibility.Visible; // } // else // { // player.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3")); // player.Play(); //t.Start(); // } if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{textBlock1.Text}.lrc")) { string lrc = ((listBox.SelectedItem as MusicItemControl).Music as string[])[0]; string lrcid = lrc.Substring(lrc.Length - 2, 2); // MessageBox.Show(He.Text(sr.ReadToEnd(), @"<lyric><![CDATA[", "]]></lyric>", 0)); FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.lrc", FileMode.Create); StreamWriter sw = new StreamWriter(fs); string ijo = He.Text(await Uuuhh.GetWebUAsync($"http://music.qq.com/miniportal/static/lyric/{lrcid}/{lrc}.xml"), @"<lyric><![CDATA[", "]]></lyric>", 0).Replace("'", "'"); if (ijo != "") { await sw.WriteAsync(ijo); await sw.FlushAsync(); sw.Close(); fs.Close(); if (LyricShow.IsOpenDeskLyric == false) { deskLyricWin = new DeskLyricWin(); deskLyricWin.Show(); LyricShow.openDeskLyric(deskLyricWin.textBlockDeskLyricFore, deskLyricWin.textBlockDeskLyricBack, deskLyricWin.canvasDeskLyricFore); LyricShow.HB = 204; LyricShow.HG = 122; LyricShow.HR = 0; LyricShow.CB = 193; LyricShow.CG = 180; LyricShow.CR = 180; } LyricShow.IsPauseLyricShow = false; getLT.getLyricAndLyricTimeByLyricPath(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.lrc"); LyricShow.initializeLyricUI(getLT.LyricAndTimeDictionary);//解析歌词->得到歌词时间和歌词 } else { deskLyricWin.Close(); LyricShow.backInitial(); LyricShow.initializeLyricUI(null); LyricShow.IsPauseLyricShow = true; } } else { if (LyricShow.IsOpenDeskLyric == false) { deskLyricWin = new DeskLyricWin(); deskLyricWin.Show(); LyricShow.openDeskLyric(deskLyricWin.textBlockDeskLyricFore, deskLyricWin.textBlockDeskLyricBack, deskLyricWin.canvasDeskLyricFore); LyricShow.HB = 204; LyricShow.HG = 122; LyricShow.HR = 0; LyricShow.CB = 193; LyricShow.CG = 180; LyricShow.CR = 180; } LyricShow.IsPauseLyricShow = false; getLT.getLyricAndLyricTimeByLyricPath(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{textBlock1.Text}.lrc"); LyricShow.initializeLyricUI(getLT.LyricAndTimeDictionary);//解析歌词->得到歌词时间和歌词 } } // } // catch { deskLyricWin.Close(); LyricShow.backInitial(); LyricShow.initializeLyricUI(null); LyricShow.IsPauseLyricShow = true; } }
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 { } }
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 { 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 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 { } } }