using System; using Shared; namespace SmartHome { class Homemusic : FrameLayout { public void show () { 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, //TextSize = 20, }; 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); var middle = new VerticalScrolViewLayout () { Height = Application.GetRealHeight (Application.DesignHeight - 130), BackgroundColor = 0XFF2F2F2F, Y = Application.GetRealHeight (130), }; AddChidren (middle); for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) { var row = new RowLayout { Height = Application.GetRealHeight (100), }; middle.AddChidren (row); var playername = new Button { Width = Application.GetRealWidth (150), Height = Application.GetRealHeight (100), X = Application.GetRealWidth (15), Gravity = Gravity.CenterVertical, Text = A31MusicModel.A31MusicModelList[i].Name, }; row.AddChidren (playername); var zhu = new Button { Width = Application.GetRealWidth (140), Height = Application.GetRealHeight (100), X = Application.GetRealWidth (300), Gravity = Gravity.CenterVertical, Text = "主播放器", }; row.AddChidren (zhu); var cong = new Button { Width = Application.GetRealWidth (140), Height = Application.GetRealHeight (100), X = Application.GetRealWidth (440), Gravity = Gravity.CenterVertical, Text = "从播放器", }; row.AddChidren (cong); zhu.MouseUpEventHandler += (sender, e) => { zhu.TextColor = 0xff436922; sendCommand (); cong.Alpha = 0.5f; }; cong.MouseUpEventHandler += (sender,e) => { cong.TextColor = 0x0ff982208; command(); }; } } void sendCommand () { System.Threading.Tasks.Task.Run (() => { System.Net.WebClient webClient = new System.Net.WebClient (); try { byte [] recevieBytes1 = webClient.DownloadData (new Uri ("http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=wpsservermode")); } catch { } }); } void command () { System.Threading.Tasks.Task.Run (() => { System.Net.WebClient webClient = new System.Net.WebClient (); try { byte [] recevieBytes1 = webClient.DownloadData (new Uri ("http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=wpsclientmode")); } catch { } }); } } }