From 0c1b0cdf903114c4214f6b9298ecd440972a42b5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 14 一月 2022 13:13:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/wjc' into wxr0114 --- HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs | 1241 ---------------------------------------------------------- 1 files changed, 3 insertions(+), 1,238 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs index 1c15666..0da47b3 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs @@ -9,7 +9,7 @@ ///寮圭獥鏂囦欢澶瑰垪琛ㄧ晫闈� /// </summary> /// <param name="musicInfo"></param> - public void FieListView(MusicInfo musicInfo) + public void FieListView(Songs musicInfo) { #region //涓绘帶浠� @@ -114,7 +114,7 @@ FileView(dialog, verticalScrolViewLayout, musicInfo); } - void FileView(Dialog dialog, VerticalScrolViewLayout verticalScrolViewLayout, MusicInfo musicInfo) + void FileView(Dialog dialog, VerticalScrolViewLayout verticalScrolViewLayout, Songs musicInfo) { verticalScrolViewLayout.RemoveAll(); for (int i = 0; i < A31MusicModel.Current.FileLists.Count; i++) @@ -207,7 +207,7 @@ EventHandler<MouseEventArgs> click = (sender, e) => { - if (null == list.MusicInfoList.Find((music) => music.URL == musicInfo.URL)) + if (null == list.MusicInfoList.Find((music) => music.name == musicInfo.name)) { list.MusicInfoList.Add(musicInfo); A31MusicModel.Save(); @@ -222,1241 +222,6 @@ } - } - /// <summary> - /// 閫変腑缁勫悎鐨勬挱鏀惧櫒鐨勭晫闈� - /// </summary> - public void PlayMergence(A31MusicModel a31MusicModel) - { - - #region - - //涓绘帶浠� - Dialog dialog = new Dialog() - { - BackgroundColor = MusicColor.PopupBackgroundColor, - }; - dialog.Show(); - //鐖舵帶浠� - FrameLayout frame = new FrameLayout { }; - dialog.AddChidren(frame); - frame.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鐧借壊蹇埗鎺т欢 - FrameLayout dialogFra = new FrameLayout() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(397), - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(250), - BackgroundColor = MusicColor.WhiteColor, - Radius = (uint)Application.GetRealHeight(12), - }; - frame.AddChidren(dialogFra); - //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� - FrameLayout topFra = new FrameLayout() - { - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(50), - }; - dialogFra.AddChidren(topFra); - //鍙栨秷鎺т欢 - Button cancelnBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.cancelMusic, - TextAlignment = TextAlignment.CenterLeft, - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(cancelnBtn); - cancelnBtn.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鏍囬鎺т欢 - Button txetBtn = new Button - { - X = cancelnBtn.Right + Application.GetRealWidth(20), - Y = Application.GetRealHeight(14), - Width = Application.GetRealWidth(152), - Height = Application.GetRealHeight(22), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text16, - TextAlignment = TextAlignment.Center, - TextID = StringId.selectedMergence, - IsBold = true, - }; - topFra.AddChidren(txetBtn); - - //纭鎺т欢 - Button confirmBtn = new Button - { - X = Application.GetRealWidth(344 - 60 - 20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.confirmMusic, - TextAlignment = TextAlignment.CenterRight, - TextColor = MusicColor.SelectedColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(confirmBtn); - - VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout - { - Y = Application.GetRealHeight(50), - Height = dialogFra.Height - Application.GetRealHeight(50), - Width = Application.GetRealWidth(344), - }; - dialogFra.AddChidren(verticalScrolViewLayout); - var playList1 = new List<A31MusicModel>(); - for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) - { - var player = A31MusicModel.A31MusicModelList[i]; - if (!player.IsOnLine) - { - //涓嶅湪绾夸笉鏄剧ず; - continue; - } - RowLayout PlayRow = new RowLayout - { - Height = Application.GetRealHeight(50), - LineColor = MusicColor.WhiteColor, - SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� - }; - verticalScrolViewLayout.AddChidren(PlayRow); - - - //鎾斁鍣ㄥ悕绉版帶浠� - Button PlayNameBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(20), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - TextAlignment = TextAlignment.CenterLeft, - Text = NamePlayer(player), - }; - PlayRow.AddChidren(PlayNameBtn); - - //閫変腑鍥炬爣鎺т欢 - Button selectedIconBtn = new Button - { - X = Application.GetRealWidth(303), - Y = Application.GetRealHeight(11), - Width = Application.GetRealWidth(28), - Height = Application.GetRealWidth(28), - UnSelectedImagePath = "MusicIcon/noSelectedIcon.png", - SelectedImagePath = "MusicIcon/selectedIcon.png", - }; - PlayRow.AddChidren(selectedIconBtn); - - - ///鍔犲ぇ鍑犵偣鑼冨洿 - Button clickBtn = new Button - { - Height = Application.GetRealHeight(50), - }; - PlayRow.AddChidren(clickBtn); - if (a31MusicModel.UniqueDeviceName == player.UniqueDeviceName) - { - clickBtn.IsSelected = selectedIconBtn.IsSelected = true; - playList1.Add(a31MusicModel); - } - clickBtn.MouseUpEventHandler += (sender, e) => - { - clickBtn.IsSelected = !clickBtn.IsSelected; - selectedIconBtn.IsSelected = clickBtn.IsSelected; - var musicPlayer = playList1.Find((c) => c.UniqueDeviceName == player.UniqueDeviceName); - if (selectedIconBtn.IsSelected) - { - if (musicPlayer == null) - { - playList1.Add(player); - } - } - else - { - if (musicPlayer != null) - { - playList1.Remove(player); - } - } - }; - //绾� - Button lineBtn = new Button - { - Y = PlayRow.Height - 1, - X = Application.GetRealWidth(20), - Width = Application.GetRealWidth(304), - Height = 1, - BackgroundColor = MusicColor.LineColor, - }; - PlayRow.AddChidren(lineBtn); - } - #endregion - confirmBtn.MouseUpEventHandler += (sender, e) => - { - - if (playList1.Count <= 1) - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.selectAtLeastTwoPlayers), false); - return; - } - int number = 0; - foreach (var musin in playList1) - { - if (musin.ServerClientType == 1) - { - number++; - } - } - if (number >= 2) - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.cannotSelectTwoOrMoreMainPlayersToCombine), false); - //濡傛灉閮芥槸涓绘挱鏀炬垜灏变笉鑳界粍鍚�; - return; - } - ///鏌ヨ鏄惁宸茬粡瀛樺湪涓绘挱鏀�; - var host_Music_If = playList1.Find((c) => c.ServerClientType == 1); - if (host_Music_If == null) - { - var playList2 = new List<A31MusicModel>(); - for (int i = 0; i < playList1.Count; i++) - { - var musics = playList1[i]; - if (musics.A31PlayStatus.status == "play") - { - playList2.Add(musics); - } - } - - if (playList2.Count == 0) - { - SelectedPlayerView(dialog, playList1, playList1); - } - else if (playList2.Count == 1) - { - //鍙湁涓�涓挱鏀惧櫒鍦ㄦ挱鏀�,榛樿涓轰富鎾彂鍣�; - dialog.Close(); - var player = playList2[0]; - MergeThreading(player, playList1); - } - else - { - SelectedPlayerView(dialog, playList1, playList2); - } - } - else - { - dialog.Close(); - MergeThreading(host_Music_If, playList1); - } - }; - } - /// <summary> - /// 閫変腑鏌愪釜闊充箰涓轰富鎾斁鍣ㄧ殑鐣岄潰 - /// </summary> - /// <param name="musicList1">鏄剧ず灏嗚缁勫悎鐨勬挱鏀惧櫒鍒楄〃</param> - /// /// <param name="musicList2">鏄剧ず鍦ㄦ挱鏀鹃煶涔愭挱鏀惧櫒鍒楄〃</param> - void SelectedPlayerView(Dialog dialogF, List<A31MusicModel> musicList1, List<A31MusicModel> musicList2) - { - #region - //涓绘帶浠� - Dialog dialog = new Dialog() - { - //BackgroundColor = Color.PopupBackgroundColor, - }; - dialog.Show(); - //鐖舵帶浠� - FrameLayout frame = new FrameLayout { }; - dialog.AddChidren(frame); - frame.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鐧借壊蹇埗鎺т欢 - FrameLayout dialogFra = new FrameLayout() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(397), - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(250), - BackgroundColor = MusicColor.WhiteColor, - Radius = (uint)Application.GetRealHeight(12), - }; - frame.AddChidren(dialogFra); - //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� - FrameLayout topFra = new FrameLayout() - { - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(50), - }; - dialogFra.AddChidren(topFra); - //鍙栨秷鎺т欢 - Button cancelnBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.cancelMusic, - TextAlignment = TextAlignment.CenterLeft, - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(cancelnBtn); - cancelnBtn.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鏍囬鎺т欢 - Button txetBtn = new Button - { - X = cancelnBtn.Right + Application.GetRealWidth(20), - Y = Application.GetRealHeight(14), - Width = Application.GetRealWidth(152), - Height = Application.GetRealHeight(22), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text16, - TextAlignment = TextAlignment.Center, - TextID = StringId.readyPlay, - IsBold = true, - }; - topFra.AddChidren(txetBtn); - //纭鎺т欢 - Button confirmBtn = new Button - { - X = Application.GetRealWidth(344 - 60 - 20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.confirmMusic, - TextAlignment = TextAlignment.CenterRight, - TextColor = MusicColor.SelectedColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(confirmBtn); - - VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout - { - Y = Application.GetRealHeight(50), - Height = dialogFra.Height - Application.GetRealHeight(50), - Width = Application.GetRealWidth(344), - }; - dialogFra.AddChidren(verticalScrolViewLayout); - //璁板綍閫変腑鐘舵�� - Button selectedBtn = new Button() { Name = "No" }; - for (int i = 0; i < musicList2.Count; i++) - { - var player = musicList2[i]; - RowLayout addFlieRow = new RowLayout - { - Height = Application.GetRealHeight(50), - LineColor = MusicColor.WhiteColor, - }; - verticalScrolViewLayout.AddChidren(addFlieRow); - - if (player.A31PlayStatus.status == "play") - { - Button songNameBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(20), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - TextAlignment = TextAlignment.CenterLeft, - Text = player.A31PlayStatus.Title, - }; - addFlieRow.AddChidren(songNameBtn); - - var wText = songNameBtn.GetTextWidth();//鑾峰彇鏂囨湰瀹藉害 - if (wText >Application.GetRealWidth(220)) - { - songNameBtn.Width = Application.GetRealWidth(220); - } - else - { - songNameBtn.Width = wText + Application.GetRealWidth(15); - } - //姝屾墜鎺т欢 - Button singerBtn = new Button - { - X = songNameBtn.Right, - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(220)- wText, - Height = Application.GetRealHeight(20), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text12, - TextAlignment = TextAlignment.CenterLeft, - Text = "-" + player.A31PlayStatus.Artist.Trim(), - }; - addFlieRow.AddChidren(singerBtn); - } - else - { - //鎾斁鍣ㄥ悕绉版帶浠� - Button PlayNameBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(20), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - TextAlignment = TextAlignment.CenterLeft, - Text = NamePlayer(player), - }; - addFlieRow.AddChidren(PlayNameBtn); - - } - - //閫変腑鍥炬爣鎺т欢 - Button selectedIconBtn = new Button - { - X = Application.GetRealWidth(303), - Y = Application.GetRealHeight(11), - Width = Application.GetRealWidth(28), - Height = Application.GetRealWidth(28), - UnSelectedImagePath = "MusicIcon/noSelectedIcon.png", - SelectedImagePath = "MusicIcon/selectedIcon.png", - Tag = player, - }; - addFlieRow.AddChidren(selectedIconBtn); - ///鍔犲ぇ鍑犵偣鑼冨洿 - Button clickBtn = new Button - { - Height = Application.GetRealHeight(50), - }; - addFlieRow.AddChidren(clickBtn); - clickBtn.MouseUpEventHandler += (sender, e) => - { - selectedBtn.IsSelected = false; - selectedBtn = selectedIconBtn; - selectedBtn.Name = "Yes"; - selectedBtn.IsSelected = true; - }; - //绾� - Button lineBtn = new Button - { - Y = addFlieRow.Height - 1, - X = Application.GetRealWidth(20), - Width = Application.GetRealWidth(304), - Height = 1, - BackgroundColor = MusicColor.LineColor, - }; - addFlieRow.AddChidren(lineBtn); - } - #endregion - confirmBtn.MouseUpEventHandler += (sender, e) => - { - if (selectedBtn.Name.ToString() == "No") - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.noSelectedPlay), false); - return; - } - dialogF.Close(); - dialog.Close(); - - var serverMusic = selectedBtn.Tag as A31MusicModel; - MergeThreading(serverMusic, musicList1); - }; - - } - /// <summary> - /// 閫変腑瑙i櫎缁勫悎鐨勬挱鏀惧櫒鐨勭晫闈� - /// </summary> - public void DetachPlayMergence(A31MusicModel a31player) - { - - #region - //涓绘帶浠� - Dialog dialog = new Dialog() - { - BackgroundColor = MusicColor.PopupBackgroundColor, - }; - dialog.Show(); - //鐖舵帶浠� - FrameLayout frame = new FrameLayout { }; - dialog.AddChidren(frame); - frame.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鐧借壊蹇埗鎺т欢 - FrameLayout dialogFra = new FrameLayout() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(397), - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(250), - BackgroundColor = MusicColor.WhiteColor, - Radius = (uint)Application.GetRealHeight(12), - }; - frame.AddChidren(dialogFra); - //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� - FrameLayout topFra = new FrameLayout() - { - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(50), - }; - dialogFra.AddChidren(topFra); - //鍙栨秷鎺т欢 - Button cancelnBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.cancelMusic, - TextAlignment = TextAlignment.CenterLeft, - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(cancelnBtn); - cancelnBtn.MouseUpEventHandler += (sen, e) => - { - dialog.Close(); - }; - //鏍囬鎺т欢 - Button txetBtn = new Button - { - X = cancelnBtn.Right + Application.GetRealWidth(20), - Y = Application.GetRealHeight(14), - Width = Application.GetRealWidth(152), - Height = Application.GetRealHeight(22), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text16, - TextAlignment = TextAlignment.Center, - TextID = StringId.checkTheReleasePlayer, - //Text = "閫変腑瑙i櫎鎾斁鍣�", - IsBold = true, - }; - topFra.AddChidren(txetBtn); - - //纭鎺т欢 - Button confirmBtn = new Button - { - X = Application.GetRealWidth(344 - 60 - 20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.confirmMusic, - TextAlignment = TextAlignment.CenterRight, - TextColor = MusicColor.SelectedColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(confirmBtn); - - VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout - { - Y = Application.GetRealHeight(50), - Height = dialogFra.Height - Application.GetRealHeight(50), - Width = Application.GetRealWidth(344), - }; - dialogFra.AddChidren(verticalScrolViewLayout); - - var playList1 = new List<A31MusicModel>(); - playList1.Add(a31player); - for (int i = 0; i < a31player.Slave.slave_list.Count; i++) - { - var slave = a31player.Slave.slave_list[i]; - var music_If = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == slave.uuid.Replace("uuid:", "")); - if (music_If != null) - { - playList1.Add(music_If); - } - } - - - var playList2 = new List<A31MusicModel>(); - for (int i = 0; i < playList1.Count; i++) - { - var player = playList1[i]; - RowLayout PlayRow = new RowLayout - { - Height = Application.GetRealHeight(50), - LineColor = MusicColor.WhiteColor, - SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� - }; - verticalScrolViewLayout.AddChidren(PlayRow); - - - //鎾斁鍣ㄥ悕绉版帶浠� - Button PlayNameBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(20), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - TextAlignment = TextAlignment.CenterLeft, - Text = NamePlayer(player), - }; - PlayRow.AddChidren(PlayNameBtn); - - - //閫変腑鍥炬爣鎺т欢 - Button selectedIconBtn = new Button - { - X = Application.GetRealWidth(303), - Y = Application.GetRealHeight(11), - Width = Application.GetRealWidth(28), - Height = Application.GetRealWidth(28), - UnSelectedImagePath = "MusicIcon/noSelectedIcon.png", - SelectedImagePath = "MusicIcon/selectedIcon.png", - }; - PlayRow.AddChidren(selectedIconBtn); - - ///鍔犲ぇ鍑犵偣鑼冨洿 - Button clickBtn = new Button - { - Height = Application.GetRealHeight(50), - Tag = player.UniqueDeviceName, - }; - PlayRow.AddChidren(clickBtn); - - clickBtn.MouseUpEventHandler += (sender, e) => - { - clickBtn.IsSelected = !clickBtn.IsSelected; - selectedIconBtn.IsSelected = clickBtn.IsSelected; - var uuid = playList2.Find((obj) => obj.UniqueDeviceName == clickBtn.Tag.ToString()); - if (selectedIconBtn.IsSelected) - { - if (uuid == null) - { - playList2.Add(player); - } - } - else - { - if (uuid != null) - { - playList2.Remove(player); - } - } - }; - //绾� - Button lineBtn = new Button - { - Y = PlayRow.Height - 1, - X = Application.GetRealWidth(20), - Width = Application.GetRealWidth(304), - Height = 1, - BackgroundColor = MusicColor.LineColor, - }; - PlayRow.AddChidren(lineBtn); - } - #endregion - confirmBtn.MouseUpEventHandler += (sender, e) => - { - if (playList1.Count == 0) - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.noCheckTheReleasePlayer), false); - return; - } - dialog.Close(); - RemoveThreading(a31player, playList2); - }; - } - /// <summary> - /// 鍙戦�佺粍鍚堝懡浠ら�昏緫澶勭悊鐨勬柟娉� - /// </summary> - /// <param name="serverMusic">涓绘挱鏀惧櫒</param> - /// <param name="musicList1"></param> - void MergeThreading(A31MusicModel serverMusic, List<A31MusicModel> musicList1) - { - A31MusicModel mainModel = null; - bool mainModelCollection = false; - MusicMain.loading.Start(Language.StringByID(StringId.inConfiguration)); - bool _if = false; - System.Threading.Tasks.Task.Run(() => - { - try - { - var statusEx = SendMethod.OpenWeb("http://" + serverMusic.IPAddress + "/httpapi.asp?command=getStatusEx"); - if (statusEx == null) - { - statusEx = SendMethod.OpenWeb("http://" + serverMusic.IPAddress + "/httpapi.asp?command=getStatusEx"); - } - if (statusEx == null) - { - return; - } - var serverIfon = Newtonsoft.Json.JsonConvert.DeserializeObject<A31Wifi>(statusEx); - if (serverIfon == null) - { - return; - } - string ssid = ""; - foreach (var b in serverIfon.ssid) - { - ssid += System.Convert.ToString(b, 16).ToUpper().Length < 2 ? "0" + System.Convert.ToString(b, 16).ToUpper() : System.Convert.ToString(b, 16).ToUpper(); - } - System.Threading.Thread.Sleep(1000); - for (int i = 0; i < musicList1.Count; i++) - { - var clientMusic = musicList1[i]; - if (clientMusic.UniqueDeviceName == serverMusic.UniqueDeviceName) - { - //杩囨护鎺変富鎾斁鍣�; - continue; - } - var dd = SendMethod.OpenWeb("http://" + clientMusic.IPAddress + "/httpapi.asp?command=ConnectMasterAp:ssid=" + ssid + ":ch=" + serverIfon.WifiChannel + ":auth=OPEN:encry=NONE:pwd=:chext=0:JoinGroupMaster:eth" + serverIfon.eth2 + ":wifi" + serverIfon.ra0 + ":uuid" + serverIfon.uuid); - if (null == SendMethod.OpenWeb("http://" + clientMusic.IPAddress + "/httpapi.asp?command=ConnectMasterAp:ssid=" + ssid + ":ch=" + serverIfon.WifiChannel + ":auth=OPEN:encry=NONE:pwd=:chext=0:JoinGroupMaster:eth" + serverIfon.eth2 + ":wifi" + serverIfon.ra0 + ":uuid" + serverIfon.uuid)) - { - if (null == SendMethod.OpenWeb("http://" + clientMusic.IPAddress + "/httpapi.asp?command=ConnectMasterAp:ssid=" + ssid + ":ch=" + serverIfon.WifiChannel + ":auth=OPEN:encry=NONE:pwd=:chext=0:JoinGroupMaster:eth" + serverIfon.eth2 + ":wifi" + serverIfon.ra0 + ":uuid" + serverIfon.uuid)) - { - - } - } - System.Threading.Thread.Sleep(1000);//绛夊緟1绉掑啀鍙戞暟鎹� - } - DateTime dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < 15 * 1000) - { - System.Threading.Thread.Sleep(1000); - try - { - var result = SendMethod.OpenWeb("http://" + serverMusic.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); - if (result != null && result != "Failed") - { - var tmepSlaves = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result); - if (tmepSlaves != null && tmepSlaves.slave_list != null && tmepSlaves.slave_list.Count != 0) - { - string str = serverMusic.Name; - for (int j = 0; j < A31MusicModel.A31MusicModelList.Count; j++) - { - var music = A31MusicModel.A31MusicModelList[j]; - if(music.collect && !mainModelCollection) - { - mainModelCollection = true; - } - if (music.UniqueDeviceName == serverMusic.UniqueDeviceName) - { - music.ServerClientType = 1; - mainModel = music; - music.Slave = tmepSlaves; - //杩囨护鎺変富鎾斁鍣�; - continue; - } - var slave_Ifon = tmepSlaves.slave_list.Find((obj) => obj.uuid.Replace("uuid:", "") == music.UniqueDeviceName); - if (null != slave_Ifon) - { - str = str + "+" + slave_Ifon.name; - //宸茬粡娣诲姞鎴愬姛 - music.ServerClientType = -1; - music.IsCanShow = false; - music.IsOnLine = false; - music.IPAddress = slave_Ifon.ip; - music.MainPlayIP = serverMusic.IPAddress; - _if = true; - } - } - serverMusic.MainPlayName = str; - foreach(var music in A31MusicModel.A31MusicModelList) - { - if(music.ServerClientType == 1) - { - music.MainPlayCollection = mainModelCollection; - } - } - A31MusicModel.Save(); - break; - } - } - } - catch { } - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - MusicMain.loading.Hide(); - ///鍙互鎻愮ず閰嶇疆澶辫触; - if (_if) - { - //閰嶇疆鎴愬姛鎵嶅彲浠ュ埛鏂扮晫闈� - MainPage.BasePageView.RemoveViewByTag("MusicMain"); - var musicMain = new MusicMain(); - MainPage.BasePageView.AddChidren(musicMain); - musicMain.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } - }); - } - }); - - } - /// <summary> - /// 瑙i櫎缁勫悎鍛戒护閫昏緫澶勭悊鐨勬柟娉� - /// </summary> - /// <param name="a31player">涓绘挱鏀惧櫒</param> - /// <param name="playList1"></param> - void RemoveThreading(A31MusicModel a31player, List<A31MusicModel> playList1) - { - MusicMain.loading.Start(Language.StringByID(StringId.lifting)); - var slaveList = new List<Slave>(); - slaveList.AddRange(a31player.Slave.slave_list); - // bool host_If = false; //琛ㄧず鏄惁鏄剧ず瑙i櫎鐨勬挱鏀� - bool _if = false; - System.Threading.Tasks.Task.Run(() => - { - try - { - var play_If = playList1.Find((obj) => obj.UniqueDeviceName == a31player.UniqueDeviceName); - if (play_If == null) - { - //瀛愰煶绠变笌涓婚煶绠辨柇寮�鐨勫懡浠� - for (int i = 0; i < playList1.Count; i++) - { - var clientMusic = playList1[i]; - if (null == SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:SlaveKickout:" + clientMusic.IPAddress)) - { - if (null == SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:SlaveKickout:" + clientMusic.IPAddress)) - { - - } - } - ///姣忚В闄や竴涓挱鏀惧櫒闇�瑕佺瓑寰�3绉� - System.Threading.Thread.Sleep(3000);//绛夊緟3绉掑啀鍙戞暟鎹� - } - } - else - { - //瑙f暎缁勭殑鍛戒护 - if (null == SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:Ungroup")) - { - if (null == SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:Ungroup")) - { - - } - } - } - DateTime dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < 12 * 1000) - { - System.Threading.Thread.Sleep(1000); - try - { - var result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); - if (result != null && result != "Failed") - { - var tmepSlaves = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result); - if (tmepSlaves != null) - { - if (tmepSlaves.slave_list.Count == 0) - { - var host_music = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == a31player.UniqueDeviceName); - if (host_music != null) - { - host_music.ServerClientType = 0;//瑙i櫎涓讳粠鍏崇郴 - host_music.MainPlayName = ""; - } - for (int a = 0; a < slaveList.Count; a++) - { - var uuid = slaveList[a].uuid.Replace("uuid:", ""); - var music = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == uuid); - if (music != null) - { - music.ServerClientType = 0;//瑙i櫎涓讳粠鍏崇郴 - music.IsCanShow = true;//鍏佽鏄剧ず - music.IsOnLine = false;//鍏堜笉鍏佽璇诲彇 - } - } - } - else - { - for (int b = 0; b < tmepSlaves.slave_list.Count; b++) - { - var uuid = tmepSlaves.slave_list[b].uuid.Replace("uuid:", ""); - var music = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == uuid); - if (music != null) - { - music.ServerClientType = 0;//瑙i櫎涓讳粠鍏崇郴 - music.IsCanShow = true;//鍏佽鏄剧ず - music.IsOnLine = false;//鍏堜笉鍏佽璇诲彇 - } - } - } - - var host_a31player = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == a31player.UniqueDeviceName); - string str = host_a31player.Name; - for (int b = 0; b < tmepSlaves.slave_list.Count; b++) - { - str = str + "+" + tmepSlaves.slave_list[b].name; - } - host_a31player.MainPlayName = str;///鏀瑰彉涓绘挱鏀惧櫒鐨勬樉绀哄悕绉� - _if = true;//瑙i櫎鎴愬姛 - A31MusicModel.Save(); - break; - } - } - - } - catch { } - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - MusicMain.loading.Hide(); - ///鍙互鎻愮ず瑙i櫎澶辫触; - if (_if) - { - //瑙i櫎鎴愬姛鎵嶅彲浠ュ埛鏂扮晫闈� - MainPage.BasePageView.RemoveViewByTag("MusicMain"); - var musicMain = new MusicMain(); - MainPage.BasePageView.AddChidren(musicMain); - musicMain.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } - }); - } - }); - - } - /// <summary> - /// 鎾斁鍣ㄥ悕绉� - /// </summary> - public string NamePlayer(A31MusicModel a31player) - { - if (a31player.ServerClientType == 1) - { - return a31player.MainPlayName; - } - else - { - return a31player.Name; - } - } - - List<A31MusicModel> volumePlayList = new List<A31MusicModel>(); - A31MusicModel currVolumePlay = null;//褰撳墠鐨勬挱鏀惧櫒 - int startVolume = 0;//涔嬪墠鐨勯煶閲� - int endVolume = 0;//鐜板湪鐨勯煶閲� - string if_volume ="";//鏍囪鏄皟鑺傛�婚煶閲忚繕鏄崟涓挱鏀惧櫒闊抽噺; - /// <summary> - /// 鎾斁鍣ㄩ煶閲忕殑鐣岄潰 - /// </summary> - /// <param name="a31player">涓绘挱鏀惧櫒</param> - public void PlayerVolumeView(A31MusicModel a31player) - { - volumePlayList.Clear(); - for (int i = 0; i < a31player.Slave.slave_list.Count; i++) - { - var slave = a31player.Slave.slave_list[i]; - var music_If = A31MusicModel.A31MusicModelList.Find((c) => c.UniqueDeviceName == slave.uuid.Replace("uuid:", "")); - if (music_If != null) - { - music_If.ServerClientType = -1; - music_If.A31PlayStatus.vol = slave.volume; - volumePlayList.Add(music_If); - } - } - volumePlayList.Add(a31player); - #region - //涓绘帶浠� - Dialog volumedialog = new Dialog(); - volumedialog.Show(); - //鐖舵帶浠� - FrameLayout frame = new FrameLayout { }; - volumedialog.AddChidren(frame); - //鐧借壊蹇埗鎺т欢 - FrameLayout dialogFra = new FrameLayout() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(397-20), - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(250+20), - BackgroundColor = MusicColor.WhiteColor, - Radius = (uint)Application.GetRealHeight(12), - }; - frame.AddChidren(dialogFra); - #region 纭 鍙栨秷 - //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� - FrameLayout topFra = new FrameLayout() - { - Width = Application.GetRealWidth(344), - Height = Application.GetRealHeight(58), - }; - dialogFra.AddChidren(topFra); - //鍙栨秷鎺т欢 - Button cancelnBtn = new Button - { - X = Application.GetRealWidth(20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.cancelMusic, - TextAlignment = TextAlignment.CenterLeft, - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(cancelnBtn); - //鏍囬鎺т欢 - Button txetBtn = new Button - { - X = cancelnBtn.Right + Application.GetRealWidth(20), - Y = Application.GetRealHeight(14), - Width = Application.GetRealWidth(152), - Height = Application.GetRealHeight(22), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text16, - TextAlignment = TextAlignment.Center, - TextID = StringId.volumeAdjustment, - IsBold = true, - }; - topFra.AddChidren(txetBtn); - //纭鎺т欢 - Button confirmBtn = new Button - { - X = Application.GetRealWidth(344 - 60 - 20), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(20), - TextID = StringId.confirmMusic, - TextAlignment = TextAlignment.CenterRight, - TextColor = MusicColor.SelectedColor, - TextSize = TextSize.Text14, - }; - topFra.AddChidren(confirmBtn); - - EventHandler<MouseEventArgs> eventHandler= (sen,e) => { - volumedialog.Close(); - if (updateVolumeThread != null) - { - try - { - if (updateVolumeThread.IsAlive) - { - updateVolumeThread.Abort(); - } - } - catch { } - } - }; - cancelnBtn.MouseUpEventHandler += eventHandler; - confirmBtn.MouseUpEventHandler += eventHandler; - frame.MouseUpEventHandler += eventHandler; - #endregion - #region 鎬婚煶閲忕殑View - FrameLayout totalVolumeFra = new FrameLayout - { - Height = Application.GetRealHeight(64), - Y = Application.GetRealHeight(58), - }; - dialogFra.AddChidren(totalVolumeFra); - Button totalvolumeTextBtn = new Button - { - X = Application.GetRealWidth(28), - Y = Application.GetRealHeight(8), - Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(14), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text10, - TextAlignment = TextAlignment.CenterLeft, - Text = Language.StringByID(StringId.totalVolume), - }; - totalVolumeFra.AddChidren(totalvolumeTextBtn); - DiyImageSeekBar totalVolSeekBar = new DiyImageSeekBar - { - Y = Application.GetRealHeight(12), - X = Application.GetRealWidth(28), - Width = Application.GetRealWidth(240), - Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢鑳屾櫙楂樺害 - IsProgressTextShow = false,//鏄剧ず鐧惧垎姣� - IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = MusicColor.SelectedColor,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "MusicIcon/progressIcon.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealWidth(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - SeekBarViewHeight = Application.GetRealWidth(8),//杩涘害鏉$殑楂樺害 - Progress = int.Parse(a31player.A31PlayStatus.vol), - SeekBarPadding = Application.GetRealWidth(20), - //ProgressChangeDelayTime= - }; - totalVolumeFra.AddChidren(totalVolSeekBar); - - Button totalVolumeValueBtn = new Button - { - X = Application.GetRealWidth(289), - Y = Application.GetRealHeight(31), - Width = Application.GetRealWidth(26 + 15), - Height = Application.GetRealHeight(17), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text12, - TextAlignment = TextAlignment.CenterLeft, - Text = totalVolSeekBar.Progress.ToString() + "%", - }; - totalVolumeFra.AddChidren(totalVolumeValueBtn); - #endregion - - VerticalScrolViewLayout volumeViewLayout = new VerticalScrolViewLayout - { - Y =Application.GetRealHeight(58+64), - Height = dialogFra.Height - Application.GetRealHeight(58+64), - Width = Application.GetRealWidth(343), - }; - dialogFra.AddChidren(volumeViewLayout); - - for (int i = 0; i < volumePlayList.Count; i++) - { - var player = volumePlayList[i]; - #region 璋冭妭褰撲釜鎾斁鍣╒iew - FrameLayout volumeFra = new FrameLayout - { - Height = Application.GetRealHeight(64), - }; - volumeViewLayout.AddChidren(volumeFra); - Button volumeTextBtn = new Button - { - X = Application.GetRealWidth(28), - Y = Application.GetRealHeight(8), - Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(14), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text10, - TextAlignment = TextAlignment.CenterLeft, - Text = player.Name + Language.StringByID(StringId.volumeMusic), - - }; - volumeFra.AddChidren(volumeTextBtn); - - DiyImageSeekBar volSeekBar = new DiyImageSeekBar - { - Y = Application.GetRealHeight(12), - X = Application.GetRealWidth(28), - Width = Application.GetRealWidth(240), - Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢鑳屾櫙楂樺害 - IsProgressTextShow = false,//鏄剧ず鐧惧垎姣� - IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = MusicColor.SelectedColor,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "MusicIcon/progressIcon.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealWidth(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - SeekBarViewHeight = Application.GetRealWidth(8),//杩涘害鏉$殑楂樺害 - Progress = int.Parse(player.A31PlayStatus.vol), - SeekBarPadding = Application.GetRealWidth(20), - //ProgressChangeDelayTime= - }; - volumeFra.AddChidren(volSeekBar); - - Button valueBtn = new Button - { - X = Application.GetRealWidth(289), - Y = Application.GetRealHeight(31), - Width = Application.GetRealWidth(26+15), - Height = Application.GetRealHeight(17), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text12, - TextAlignment = TextAlignment.CenterLeft, - Text = player.A31PlayStatus.vol + "%", - }; - volumeFra.AddChidren(valueBtn); - #endregion - ///闊抽噺杩涘害鏉$偣鍑讳簨浠� - EventHandler<int> progressClick = (sender, e) => - { - if (currVolumePlay == null || (currVolumePlay != null && currVolumePlay.UniqueDeviceName != player.UniqueDeviceName)) - { - currVolumePlay = player; - } - endVolume = e; - if_volume = "Volume"; - valueBtn.Text = volSeekBar.Progress + "%"; - }; - volSeekBar.OnProgressChangedEvent += progressClick; - volSeekBar.OnStopTrackingTouchEvent += progressClick; - } - - EventHandler<int> totalProgressClick = (sender, e) => - { - if_volume = "totalVolume"; - endVolume = e; - totalVolumeValueBtn.Text = totalVolSeekBar.Progress + "%"; - for (int j = 0; j < volumePlayList.Count; j++) - { - var music = volumePlayList[j]; - var frameLayout = (FrameLayout)volumeViewLayout.GetChildren(j); - var diyImageSeekBar = (DiyImageSeekBar)frameLayout.GetChildren(1); - var button = (Button)frameLayout.GetChildren(2); - diyImageSeekBar.Progress = totalVolSeekBar.Progress; - button.Text = totalVolSeekBar.Progress + "%"; - } - }; - totalVolSeekBar.OnProgressChangedEvent += totalProgressClick; - totalVolSeekBar.OnStopTrackingTouchEvent += totalProgressClick; - #endregion - - } - /// <summary> - /// 瀹氭椂闊抽噺骞朵笖鍙戦�佸懡浠� - /// </summary> - System.Threading.Thread updateVolumeThread; - public void UpdateVolume() - { - if (updateVolumeThread != null) { - try - { - if (updateVolumeThread.IsAlive) { - updateVolumeThread.Abort(); - } - } - catch { } - } - updateVolumeThread = new System.Threading.Thread(() => - { - try - { - while (true) - { - System.Threading.Thread.Sleep(500); - if (startVolume == endVolume) - { - continue; - } - startVolume = endVolume; - if (if_volume == "totalVolume") - { - for (int j = 0; j < volumePlayList.Count; j++) - { - var music = volumePlayList[j]; - //姣忎釜500姣鍙戜粠鎾斁鍣ㄩ煶閲忓懡浠� - SendMethod.ControlVolume(endVolume, music); - System.Threading.Thread.Sleep(1000); - - } - } - else if(if_volume == "Volume") - { - if (currVolumePlay == null) - { - continue; - } - SendMethod.ControlVolume(endVolume, currVolumePlay); - } - - - } - } - catch { } - }) - { IsBackground = true }; - updateVolumeThread.Start(); } } -- Gitblit v1.8.0