using System; using System.Collections.Generic; using System.Text; using Shared; using System.Xml; using Shared.SimpleControl.R; namespace Shared.SimpleControl.Phone.Music { /// /// 网络流媒体音乐界面 /// class A31EqualizerMode : FrameLayout { /// /// 古典模式 /// Button classicalmodel; /// /// 流行模式 /// Button popularmodel; /// /// 爵士模式 /// Button jazzymodel; /// /// 歌唱模式 /// Button vocalmodel; /// /// 关闭均衡 /// Button closemodel; //0 close关闭均衡 1 Classic古典模式 2 Popularliu流行模式 3 Jazzy爵士模式 4 Vocal模式 A31MusicModel currentMusiceA31; public void Show(A31MusicModel a31) { currentMusiceA31 = a31; //BackgroundColor = 0XFF2F2F2F; AddChidren(new Button { Height = Application.GetRealHeight(30), BackgroundColor = SkinStyle.Current.MainColor, }); var topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(100), Y = Application.GetRealHeight(30), BackgroundColor = SkinStyle.Current.MainColor, }; AddChidren(topFrameLayout); var btnTitle = new Button { Text="均衡器模式", //TextID = MyInternationalizationString.streamingmusic, }; topFrameLayout.AddChidren(btnTitle); var back = new Button { Width = Application.GetRealWidth(82), Height = Application.GetRealHeight(89), X = Application.GetRealWidth(10), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "MusicIcon/HomepageBack.png", }; topFrameLayout.AddChidren(back); back.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; var hdl = new Button { Width = Application.GetRealWidth(104), Height = Application.GetRealHeight(32), X = Application.GetRealWidth(530), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "MusicIcon/HDL.png", }; topFrameLayout.AddChidren(hdl); FrameLayout middle = new FrameLayout () { Height = Application.GetRealHeight (Application.DesignHeight - 130), BackgroundColor = 0XFF2F2F2F, Y = Application.GetRealHeight (130), }; AddChidren(middle); //古典模式1 classicalmodel = new Button { Width = Application.GetRealWidth (640 / 4), Height = Application.GetRealHeight (100), Text="古典模式", //TextID = MyInternationalizationString.Musicpopular, Y=Application.GetRealHeight(80), X=Application.GetRealWidth(30), }; middle.AddChidren(classicalmodel); classicalmodel.MouseUpEventHandler += (sender, e) => { classicalmodel.TextColor = 0xffFE5E00; popularmodel.TextColor = 0xFFFFFFFF; jazzymodel.TextColor = 0xFFFFFFFF; vocalmodel.TextColor = 0xFFFFFFFF; closemodel.TextColor = 0xFFFFFFFF; sendCommand (1); }; //流行模式2 popularmodel = new Button { Width = Application.GetRealWidth (640 / 4), Height = Application.GetRealHeight (100), Text="流行模式", //TextID = MyInternationalizationString.Musicballad, Y=Application.GetRealHeight(220), X=Application.GetRealWidth(30), }; middle.AddChidren(popularmodel); popularmodel.MouseUpEventHandler += (sender, e) => { classicalmodel.TextColor = 0xFFFFFFFF; popularmodel.TextColor = 0xffFE5E00; jazzymodel.TextColor = 0xFFFFFFFF; vocalmodel.TextColor = 0xFFFFFFFF; closemodel.TextColor = 0xFFFFFFFF; sendCommand (2); }; //爵士模式3 jazzymodel = new Button { Width = Application.GetRealWidth (640 / 4), Height = Application.GetRealHeight (100), Text="爵士模式", //TextID = MyInternationalizationString.Musicrock, Y=Application.GetRealHeight(360), X=Application.GetRealWidth(30), }; middle.AddChidren(jazzymodel); jazzymodel.MouseUpEventHandler += (sender, e) => { classicalmodel.TextColor = 0xFFFFFFFF; popularmodel.TextColor = 0xFFFFFFFF; jazzymodel.TextColor = 0xffFE5E00; vocalmodel.TextColor = 0xFFFFFFFF; closemodel.TextColor = 0xFFFFFFFF; sendCommand (3); }; //歌唱模式4 vocalmodel = new Button { Width = Application.GetRealWidth (640 / 4), Height = Application.GetRealHeight (100), //TextID = MyInternationalizationString.Musicclassical, Text="歌唱模式", Y=Application.GetRealHeight(500), X=Application.GetRealWidth(30), }; middle.AddChidren(vocalmodel); vocalmodel.MouseUpEventHandler += (sender, e) => { classicalmodel.TextColor = 0xFFFFFFFF; popularmodel.TextColor = 0xFFFFFFFF; jazzymodel.TextColor = 0xFFFFFFFF; vocalmodel.TextColor = 0xffFE5E00; closemodel.TextColor = 0xFFFFFFFF; sendCommand (4); }; //关闭均衡0 closemodel = new Button { Width = Application.GetRealWidth (640 / 4), Height = Application.GetRealHeight (100), //TextID = MyInternationalizationString.Musicclassical, Text="关闭均衡", Y=Application.GetRealHeight(640), X=Application.GetRealWidth(30), }; middle.AddChidren(closemodel); closemodel.MouseUpEventHandler += (sender, e) => { classicalmodel.TextColor = 0xFFFFFFFF; popularmodel.TextColor = 0xFFFFFFFF; jazzymodel.TextColor = 0xFFFFFFFF; vocalmodel.TextColor = 0xFFFFFFFF; closemodel.TextColor = 0xffFE5E00; sendCommand (0); }; updateStatus (); } void sendCommand (int mode) { System.Threading.Tasks.Task.Run (() => { Shared.Net.MyWebClient webClient = new Shared.Net.MyWebClient (); try { byte [] recevieBytes1 = webClient.DownloadData (new Uri ("http://" + currentMusiceA31.IPAddress + "/httpapi.asp?command=setPlayerCmd:equalizer:" + mode)); } catch { } }); } void updateStatus () { Shared.Net.MyWebClient webClient = new Shared.Net.MyWebClient (); try { byte [] recevieBytes1 = webClient.DownloadData (new Uri ("http://" + currentMusiceA31.IPAddress + "/httpapi.asp?command=getEqualizer")); var dd = System.Text.Encoding.UTF8.GetString (recevieBytes1, 0, recevieBytes1.Length); if (dd == "1") { classicalmodel.TextColor = 0xffFE5E00; } else if (dd == "2") { popularmodel.TextColor = 0xffFE5E00; } else if (dd == "3") { jazzymodel.TextColor = 0xffFE5E00; } else if (dd == "4") { vocalmodel.TextColor = 0xffFE5E00; } else if (dd == "0") { closemodel.TextColor = 0xffFE5E00; } } catch { } } } }