From b764dff5c4f4a7b0cde45a8d3eb28ff2a315cc29 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 19 八月 2020 16:46:53 +0800
Subject: [PATCH] 2020-08-19-1

---
 HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs |  446 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 260 insertions(+), 186 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
index fe5d085..c4d2d9f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs
@@ -15,7 +15,7 @@
             //涓绘帶浠�
             Dialog dialog = new Dialog()
             {
-                BackgroundColor = Color.PopupBackgroundColor,
+                BackgroundColor = MusicColor.PopupBackgroundColor,
             };
             dialog.Show();
             //鐖舵帶浠�
@@ -32,7 +32,7 @@
                 Y = Application.GetRealHeight(187),
                 Width = Application.GetRealWidth(344),
                 Height = Application.GetRealHeight(460),
-                BackgroundColor = Color.WhiteColor,
+                BackgroundColor = MusicColor.WhiteColor,
                 Radius = (uint)Application.GetRealHeight(12),
             };
             frame.AddChidren(dialogFra);
@@ -52,7 +52,7 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.cancelMusic,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = Color.MusicNoTxetColor,
+                TextColor = MusicColor.MusicNoTxetColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(cancelnBtn);
@@ -67,7 +67,7 @@
                 Y = Application.GetRealHeight(23),
                 Width = Application.GetRealWidth(152),
                 Height = Application.GetRealHeight(22),
-                TextColor = Color.TextColor,
+                TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 TextID = StringId.myList,
@@ -123,7 +123,7 @@
                 RowLayout addFlieRow = new RowLayout
                 {
                     Height = Application.GetRealHeight(78),
-                    LineColor = Color.WhiteColor,
+                    LineColor = MusicColor.WhiteColor,
                     SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
                 };
                 verticalScrolViewLayout.AddChidren(addFlieRow);
@@ -145,7 +145,7 @@
                     Y = Application.GetRealHeight(29),
                     Width = Application.GetRealWidth(189),
                     Height = Application.GetRealHeight(20),
-                    TextColor = Color.TextColor,
+                    TextColor = MusicColor.TextColor,
                     TextSize = TextSize.Text14,
                     TextAlignment = TextAlignment.CenterLeft,
                     Text = list.ListName,
@@ -155,9 +155,9 @@
                 ///缂栬緫鎺т欢
                 var editBtn = new Button
                 {
-                    BackgroundColor = Color.MusicEditColor,
+                    BackgroundColor = MusicColor.MusicEditColor,
                     Text = Language.StringByID(StringId.editMusic),
-                    TextColor = Color.WhiteColor,
+                    TextColor = MusicColor.WhiteColor,
                     TextSize = TextSize.Text16,
                 };
                 addFlieRow.AddRightView(editBtn);
@@ -188,9 +188,9 @@
                 ///鍒犻櫎鎺т欢
                 var delBtn = new Button
                 {
-                    BackgroundColor = Color.MusicDelColor,
+                    BackgroundColor = MusicColor.MusicDelColor,
                     Text = Language.StringByID(StringId.delMusic),
-                    TextColor = Color.WhiteColor,
+                    TextColor = MusicColor.WhiteColor,
                     TextSize = TextSize.Text16,
                 };
                 addFlieRow.AddRightView(delBtn);
@@ -228,13 +228,23 @@
         /// </summary>
         public void PlayMergence(A31MusicModel a31MusicModel)
         {
-
+            int number1 = 0;
+            for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+            {
+                var player = A31MusicModel.A31MusicModelList[i];
+                if (!player.IsOnLine)
+                {
+                    //涓嶅湪绾夸笉鏄剧ず;
+                    continue;
+                }
+                number1 = number1 + 1;
+            }
             #region
 
             //涓绘帶浠�
             Dialog dialog = new Dialog()
             {
-                BackgroundColor = Color.PopupBackgroundColor,
+                BackgroundColor = MusicColor.PopupBackgroundColor,
             };
             dialog.Show();
             //鐖舵帶浠�
@@ -248,10 +258,10 @@
             FrameLayout dialogFra = new FrameLayout()
             {
                 X = Application.GetRealWidth(16),
-                Y = Application.GetRealHeight(397),
+                Y = Application.GetRealHeight(667 - (50 + number1 * 50) - 20),
                 Width = Application.GetRealWidth(344),
-                Height = Application.GetRealHeight(250),
-                BackgroundColor = Color.WhiteColor,
+                Height = Application.GetRealHeight(50 + number1 * 50),
+                BackgroundColor = MusicColor.WhiteColor,
                 Radius = (uint)Application.GetRealHeight(12),
             };
             frame.AddChidren(dialogFra);
@@ -271,7 +281,7 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.cancelMusic,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = Color.MusicNoTxetColor,
+                TextColor = MusicColor.MusicNoTxetColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(cancelnBtn);
@@ -286,7 +296,7 @@
                 Y = Application.GetRealHeight(14),
                 Width = Application.GetRealWidth(152),
                 Height = Application.GetRealHeight(22),
-                TextColor = Color.TextColor,
+                TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 TextID = StringId.selectedMergence,
@@ -303,18 +313,37 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.confirmMusic,
                 TextAlignment = TextAlignment.CenterRight,
-                TextColor = Color.SelectedColor,
+                TextColor = MusicColor.SelectedColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(confirmBtn);
-
-            VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout
+            ///澶т簬4鐢ㄤ笂涓嬫粦鍔ㄦ帶浠�
+            VerticalScrolViewLayout verticalScrolViewLayout = null;
+            FrameLayout frameLayout = null;
+            if (number1 > 4)
             {
-                Y = Application.GetRealHeight(50),
-                Height = dialogFra.Height - Application.GetRealHeight(50),
-                Width = Application.GetRealWidth(344),
-            };
-            dialogFra.AddChidren(verticalScrolViewLayout);
+                verticalScrolViewLayout = new VerticalScrolViewLayout
+                {
+                    Y = Application.GetRealHeight(50),
+                    Height = dialogFra.Height - Application.GetRealHeight(50),
+                    Width = Application.GetRealWidth(344),
+
+                };
+                dialogFra.AddChidren(verticalScrolViewLayout);
+
+            }
+            else
+            {
+                frameLayout = new FrameLayout
+                {
+                    Y = Application.GetRealHeight(50),
+                    Height = dialogFra.Height - Application.GetRealHeight(50),
+                    Width = Application.GetRealWidth(344),
+
+                };
+                dialogFra.AddChidren(frameLayout);
+            }
+
             var playList1 = new List<A31MusicModel>();
             for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
             {
@@ -327,11 +356,17 @@
                 RowLayout PlayRow = new RowLayout
                 {
                     Height = Application.GetRealHeight(50),
-                    LineColor = Color.WhiteColor,
-                    SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
+                    LineColor = 0x00000000,
                 };
-                verticalScrolViewLayout.AddChidren(PlayRow);
-
+                if (number1 > 4)
+                {
+                    verticalScrolViewLayout.AddChidren(PlayRow);
+                }
+                else
+                {
+                    PlayRow.Y = Application.GetRealHeight(i * 50);
+                    frameLayout.AddChidren(PlayRow);
+                }
 
                 //鎾斁鍣ㄥ悕绉版帶浠�
                 Button PlayNameBtn = new Button
@@ -340,7 +375,7 @@
                     Y = Application.GetRealHeight(15),
                     Width = Application.GetRealWidth(150),
                     Height = Application.GetRealHeight(20),
-                    TextColor = Color.TextColor,
+                    TextColor = MusicColor.TextColor,
                     TextSize = TextSize.Text14,
                     TextAlignment = TextAlignment.CenterLeft,
                     Text = NamePlayer(player),
@@ -358,7 +393,7 @@
                     SelectedImagePath = "MusicIcon/selectedIcon.png",
                 };
                 PlayRow.AddChidren(selectedIconBtn);
-               
+
 
                 ///鍔犲ぇ鍑犵偣鑼冨洿
                 Button clickBtn = new Button
@@ -391,16 +426,6 @@
                         }
                     }
                 };
-                //绾�
-                Button lineBtn = new Button
-                {
-                    Y = PlayRow.Height - 1,
-                    X = Application.GetRealWidth(20),
-                    Width = Application.GetRealWidth(304),
-                    Height = 1,
-                    BackgroundColor = Color.LineColor,
-                };
-                PlayRow.AddChidren(lineBtn);
             }
             #endregion
             confirmBtn.MouseUpEventHandler += (sender, e) =>
@@ -490,7 +515,7 @@
                 Y = Application.GetRealHeight(397),
                 Width = Application.GetRealWidth(344),
                 Height = Application.GetRealHeight(250),
-                BackgroundColor = Color.WhiteColor,
+                BackgroundColor = MusicColor.WhiteColor,
                 Radius = (uint)Application.GetRealHeight(12),
             };
             frame.AddChidren(dialogFra);
@@ -510,7 +535,7 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.cancelMusic,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = Color.MusicNoTxetColor,
+                TextColor = MusicColor.MusicNoTxetColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(cancelnBtn);
@@ -525,7 +550,7 @@
                 Y = Application.GetRealHeight(14),
                 Width = Application.GetRealWidth(152),
                 Height = Application.GetRealHeight(22),
-                TextColor = Color.TextColor,
+                TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 TextID = StringId.readyPlay,
@@ -541,7 +566,7 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.confirmMusic,
                 TextAlignment = TextAlignment.CenterRight,
-                TextColor = Color.SelectedColor,
+                TextColor = MusicColor.SelectedColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(confirmBtn);
@@ -561,7 +586,7 @@
                 RowLayout addFlieRow = new RowLayout
                 {
                     Height = Application.GetRealHeight(50),
-                    LineColor = Color.WhiteColor,
+                    LineColor = MusicColor.WhiteColor,
                 };
                 verticalScrolViewLayout.AddChidren(addFlieRow);
 
@@ -573,7 +598,7 @@
                         Y = Application.GetRealHeight(15),
                         Width = Application.GetRealWidth(150),
                         Height = Application.GetRealHeight(20),
-                        TextColor = Color.TextColor,
+                        TextColor = MusicColor.TextColor,
                         TextSize = TextSize.Text14,
                         TextAlignment = TextAlignment.CenterLeft,
                         Text = player.A31PlayStatus.Title,
@@ -581,7 +606,7 @@
                     addFlieRow.AddChidren(songNameBtn);
 
                     var wText = songNameBtn.GetTextWidth();//鑾峰彇鏂囨湰瀹藉害
-                    if (wText >Application.GetRealWidth(220))
+                    if (wText > Application.GetRealWidth(220))
                     {
                         songNameBtn.Width = Application.GetRealWidth(220);
                     }
@@ -594,9 +619,9 @@
                     {
                         X = songNameBtn.Right,
                         Y = Application.GetRealHeight(15),
-                        Width = Application.GetRealWidth(220)- wText,
+                        Width = Application.GetRealWidth(220) - wText,
                         Height = Application.GetRealHeight(20),
-                        TextColor = Color.MusicNoTxetColor,
+                        TextColor = MusicColor.MusicNoTxetColor,
                         TextSize = TextSize.Text12,
                         TextAlignment = TextAlignment.CenterLeft,
                         Text = "-" + player.A31PlayStatus.Artist.Trim(),
@@ -612,7 +637,7 @@
                         Y = Application.GetRealHeight(15),
                         Width = Application.GetRealWidth(150),
                         Height = Application.GetRealHeight(20),
-                        TextColor = Color.TextColor,
+                        TextColor = MusicColor.TextColor,
                         TextSize = TextSize.Text14,
                         TextAlignment = TextAlignment.CenterLeft,
                         Text = NamePlayer(player),
@@ -653,7 +678,7 @@
                     X = Application.GetRealWidth(20),
                     Width = Application.GetRealWidth(304),
                     Height = 1,
-                    BackgroundColor = Color.LineColor,
+                    BackgroundColor = MusicColor.LineColor,
                 };
                 addFlieRow.AddChidren(lineBtn);
             }
@@ -678,12 +703,22 @@
         /// </summary>
         public void DetachPlayMergence(A31MusicModel a31player)
         {
-
+            int number1 = 0;
+            for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+            {
+                var player = A31MusicModel.A31MusicModelList[i];
+                if (!player.IsOnLine)
+                {
+                    //涓嶅湪绾夸笉鏄剧ず;
+                    continue;
+                }
+                number1 = number1 + 1;
+            }
             #region
             //涓绘帶浠�
             Dialog dialog = new Dialog()
             {
-                BackgroundColor = Color.PopupBackgroundColor,
+                BackgroundColor = MusicColor.PopupBackgroundColor,
             };
             dialog.Show();
             //鐖舵帶浠�
@@ -697,10 +732,10 @@
             FrameLayout dialogFra = new FrameLayout()
             {
                 X = Application.GetRealWidth(16),
-                Y = Application.GetRealHeight(397),
+                Y = Application.GetRealHeight(667 - (50 + number1 * 50) - 20),
                 Width = Application.GetRealWidth(344),
-                Height = Application.GetRealHeight(250),
-                BackgroundColor = Color.WhiteColor,
+                Height = Application.GetRealHeight(50 + number1 * 50),
+                BackgroundColor = MusicColor.WhiteColor,
                 Radius = (uint)Application.GetRealHeight(12),
             };
             frame.AddChidren(dialogFra);
@@ -720,7 +755,7 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.cancelMusic,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = Color.MusicNoTxetColor,
+                TextColor = MusicColor.MusicNoTxetColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(cancelnBtn);
@@ -735,7 +770,7 @@
                 Y = Application.GetRealHeight(14),
                 Width = Application.GetRealWidth(152),
                 Height = Application.GetRealHeight(22),
-                TextColor = Color.TextColor,
+                TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 TextID = StringId.checkTheReleasePlayer,
@@ -753,18 +788,36 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.confirmMusic,
                 TextAlignment = TextAlignment.CenterRight,
-                TextColor = Color.SelectedColor,
+                TextColor = MusicColor.SelectedColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(confirmBtn);
-
-            VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout
+            ///澶т簬4鐢ㄤ笂涓嬫粦鍔ㄦ帶浠�
+            VerticalScrolViewLayout verticalScrolViewLayout = null;
+            FrameLayout frameLayout = null;
+            if (number1 > 4)
             {
-                Y = Application.GetRealHeight(50),
-                Height = dialogFra.Height - Application.GetRealHeight(50),
-                Width = Application.GetRealWidth(344),
-            };
-            dialogFra.AddChidren(verticalScrolViewLayout);
+                verticalScrolViewLayout = new VerticalScrolViewLayout
+                {
+                    Y = Application.GetRealHeight(50),
+                    Height = dialogFra.Height - Application.GetRealHeight(50),
+                    Width = Application.GetRealWidth(344),
+
+                };
+                dialogFra.AddChidren(verticalScrolViewLayout);
+
+            }
+            else
+            {
+                frameLayout = new FrameLayout
+                {
+                    Y = Application.GetRealHeight(50),
+                    Height = dialogFra.Height - Application.GetRealHeight(50),
+                    Width = Application.GetRealWidth(344),
+
+                };
+                dialogFra.AddChidren(frameLayout);
+            }
 
             var playList1 = new List<A31MusicModel>();
             playList1.Add(a31player);
@@ -786,11 +839,17 @@
                 RowLayout PlayRow = new RowLayout
                 {
                     Height = Application.GetRealHeight(50),
-                    LineColor = Color.WhiteColor,
-                    SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
+                    LineColor =0x00000000, //MusicColor.WhiteColor,
                 };
-                verticalScrolViewLayout.AddChidren(PlayRow);
-
+                if (number1 > 4)
+                {
+                    verticalScrolViewLayout.AddChidren(PlayRow);
+                }
+                else
+                {
+                    PlayRow.Y = Application.GetRealHeight(i * 50);
+                    frameLayout.AddChidren(PlayRow);
+                }
 
                 //鎾斁鍣ㄥ悕绉版帶浠�
                 Button PlayNameBtn = new Button
@@ -799,7 +858,7 @@
                     Y = Application.GetRealHeight(15),
                     Width = Application.GetRealWidth(150),
                     Height = Application.GetRealHeight(20),
-                    TextColor = Color.TextColor,
+                    TextColor = MusicColor.TextColor,
                     TextSize = TextSize.Text14,
                     TextAlignment = TextAlignment.CenterLeft,
                     Text = NamePlayer(player),
@@ -847,16 +906,7 @@
                         }
                     }
                 };
-                //绾�
-                Button lineBtn = new Button
-                {
-                    Y = PlayRow.Height - 1,
-                    X = Application.GetRealWidth(20),
-                    Width = Application.GetRealWidth(304),
-                    Height = 1,
-                    BackgroundColor = Color.LineColor,
-                };
-                PlayRow.AddChidren(lineBtn);
+             
             }
             #endregion
             confirmBtn.MouseUpEventHandler += (sender, e) =>
@@ -878,7 +928,7 @@
         void MergeThreading(A31MusicModel serverMusic, List<A31MusicModel> musicList1)
         {
             A31MusicModel mainModel = null;
-            bool mainModelCollection = false;   
+            bool mainModelCollection = false;
             MusicMain.loading.Start(Language.StringByID(StringId.inConfiguration));
             bool _if = false;
             System.Threading.Tasks.Task.Run(() =>
@@ -939,7 +989,7 @@
                                     for (int j = 0; j < A31MusicModel.A31MusicModelList.Count; j++)
                                     {
                                         var music = A31MusicModel.A31MusicModelList[j];
-                                        if(music.collection && !mainModelCollection)
+                                        if (music.collection && !mainModelCollection)
                                         {
                                             mainModelCollection = true;
                                         }
@@ -965,9 +1015,9 @@
                                         }
                                     }
                                     serverMusic.MainPlayName = str;
-                                    foreach(var music in A31MusicModel.A31MusicModelList)
+                                    foreach (var music in A31MusicModel.A31MusicModelList)
                                     {
-                                        if(music.ServerClientType == 1)
+                                        if (music.ServerClientType == 1)
                                         {
                                             music.MainPlayCollection = mainModelCollection;
                                         }
@@ -1011,7 +1061,7 @@
             MusicMain.loading.Start(Language.StringByID(StringId.lifting));
             var slaveList = new List<Slave>();
             slaveList.AddRange(a31player.Slave.slave_list);
-           // bool host_If = false; //琛ㄧず鏄惁鏄剧ず瑙i櫎鐨勬挱鏀�
+            // bool host_If = false; //琛ㄧず鏄惁鏄剧ず瑙i櫎鐨勬挱鏀�
             bool _if = false;
             System.Threading.Tasks.Task.Run(() =>
             {
@@ -1145,17 +1195,31 @@
                 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();
@@ -1163,32 +1227,18 @@
             //鐖舵帶浠�
             FrameLayout frame = new FrameLayout { };
             volumedialog.AddChidren(frame);
-            frame.MouseUpEventHandler += (sen, e) =>
-            {
-                volumedialog.Close();
-                if (updateVolumeThread != null)
-                {
-                    try
-                    {
-                        if (updateVolumeThread.IsAlive)
-                        {
-                            updateVolumeThread.Abort();
-                        }
-                    }
-                    catch { }
-                }
-            };
             //鐧借壊蹇埗鎺т欢
             FrameLayout dialogFra = new FrameLayout()
             {
                 X = Application.GetRealWidth(16),
-                Y = Application.GetRealHeight(397),
+                Y = Application.GetRealHeight(397 - 20),
                 Width = Application.GetRealWidth(344),
-                Height = Application.GetRealHeight(250),
-                BackgroundColor = Color.WhiteColor,
+                Height = Application.GetRealHeight(250 + 20),
+                BackgroundColor = MusicColor.WhiteColor,
                 Radius = (uint)Application.GetRealHeight(12),
             };
             frame.AddChidren(dialogFra);
+            #region 纭 鍙栨秷
             //鏄剧ず澶撮儴淇℃伅鐖舵帶浠�
             FrameLayout topFra = new FrameLayout()
             {
@@ -1205,25 +1255,10 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.cancelMusic,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextColor = Color.MusicNoTxetColor,
+                TextColor = MusicColor.MusicNoTxetColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(cancelnBtn);
-            cancelnBtn.MouseUpEventHandler += (sen, e) =>
-            {
-                volumedialog.Close();
-                if (updateVolumeThread != null)
-                {
-                    try
-                    {
-                        if (updateVolumeThread.IsAlive)
-                        {
-                            updateVolumeThread.Abort();
-                        }
-                    }
-                    catch { }
-                }
-            };
             //鏍囬鎺т欢
             Button txetBtn = new Button
             {
@@ -1231,7 +1266,7 @@
                 Y = Application.GetRealHeight(14),
                 Width = Application.GetRealWidth(152),
                 Height = Application.GetRealHeight(22),
-                TextColor = Color.TextColor,
+                TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 TextID = StringId.volumeAdjustment,
@@ -1247,11 +1282,12 @@
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.confirmMusic,
                 TextAlignment = TextAlignment.CenterRight,
-                TextColor = Color.SelectedColor,
+                TextColor = MusicColor.SelectedColor,
                 TextSize = TextSize.Text14,
             };
             topFra.AddChidren(confirmBtn);
-            confirmBtn.MouseUpEventHandler += (sen, e) =>
+
+            EventHandler<MouseEventArgs> eventHandler = (sen, e) =>
             {
                 volumedialog.Close();
                 if (updateVolumeThread != null)
@@ -1266,31 +1302,72 @@
                     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.GetMinRealAverage(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
+                SeekBarViewHeight = Application.GetMinRealAverage(8),//杩涘害鏉$殑楂樺害
+                Progress = int.Parse(a31player.A31PlayStatus.vol),
+                //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),
-                Height = dialogFra.Height - Application.GetRealHeight(58),
+                Y = Application.GetRealHeight(58 + 64),
+                Height = dialogFra.Height - Application.GetRealHeight(58 + 64),
                 Width = Application.GetRealWidth(343),
             };
             dialogFra.AddChidren(volumeViewLayout);
-            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);
 
             for (int i = 0; i < volumePlayList.Count; i++)
             {
                 var player = volumePlayList[i];
+                #region 璋冭妭褰撲釜鎾斁鍣╒iew
                 FrameLayout volumeFra = new FrameLayout
                 {
                     Height = Application.GetRealHeight(64),
@@ -1302,20 +1379,13 @@
                     Y = Application.GetRealHeight(8),
                     Width = Application.GetRealWidth(200),
                     Height = Application.GetRealHeight(14),
-                    TextColor = Color.MusicNoTxetColor,
+                    TextColor = MusicColor.MusicNoTxetColor,
                     TextSize = TextSize.Text10,
                     TextAlignment = TextAlignment.CenterLeft,
+                    Text = player.Name + Language.StringByID(StringId.volumeMusic),
 
                 };
                 volumeFra.AddChidren(volumeTextBtn);
-                if (player.ServerClientType == -1)
-                {
-                    volumeTextBtn.Text = player.Name + Language.StringByID(StringId.volumeMusic);
-                }
-                else if (player.ServerClientType == 1)
-                {
-                    volumeTextBtn.Text = Language.StringByID(StringId.totalVolume);
-                }
 
                 DiyImageSeekBar volSeekBar = new DiyImageSeekBar
                 {
@@ -1325,7 +1395,7 @@
                     Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢鑳屾櫙楂樺害
                     IsProgressTextShow = false,//鏄剧ず鐧惧垎姣�
                     IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔�
-                    ProgressBarColor = Color.SelectedColor,//閫変腑杩涘害鏉¢鑹�
+                    ProgressBarColor = MusicColor.SelectedColor,//閫変腑杩涘害鏉¢鑹�
                     ThumbImagePath = "MusicIcon/progressIcon.png",//杩涘害鏉℃寜閽浘鏍�
                     ThumbImageHeight = Application.GetMinRealAverage(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
                     SeekBarViewHeight = Application.GetMinRealAverage(8),//杩涘害鏉$殑楂樺害
@@ -1338,44 +1408,47 @@
                 {
                     X = Application.GetRealWidth(289),
                     Y = Application.GetRealHeight(31),
-                    Width = Application.GetRealWidth(26+15),
+                    Width = Application.GetRealWidth(26 + 15),
                     Height = Application.GetRealHeight(17),
-                    TextColor = Color.MusicNoTxetColor,
+                    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 (player.ServerClientType == -1)
-                    {
-                        valueBtn.Text = volSeekBar.Progress + "%";
-                    }
-                    else if (player.ServerClientType == 1)
-                    {
-                        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 = volSeekBar.Progress;
-                            button.Text = volSeekBar.Progress + "%";
-                        }
-                    }
+                    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
 
         }
@@ -1385,10 +1458,12 @@
         System.Threading.Thread updateVolumeThread;
         public void UpdateVolume()
         {
-            if (updateVolumeThread != null) {
+            if (updateVolumeThread != null)
+            {
                 try
                 {
-                    if (updateVolumeThread.IsAlive) {
+                    if (updateVolumeThread.IsAlive)
+                    {
                         updateVolumeThread.Abort();
                     }
                 }
@@ -1401,32 +1476,31 @@
                     while (true)
                     {
                         System.Threading.Thread.Sleep(500);
-                        if (startVolume == endVolume || currVolumePlay == null)
+                        if (startVolume == endVolume)
                         {
                             continue;
                         }
                         startVolume = endVolume;
-
-                        if (currVolumePlay.ServerClientType == -1)
+                        if (if_volume == "totalVolume")
                         {
-                            SendMethod.ControlVolume(endVolume, currVolumePlay);
-                        }
-                        else if (currVolumePlay.ServerClientType == 1)
-                        {
-                            //鍏堝彂涓绘挱鏀惧櫒闊抽噺鍛戒护
-                            SendMethod.ControlVolume(endVolume, currVolumePlay);
                             for (int j = 0; j < volumePlayList.Count; j++)
                             {
                                 var music = volumePlayList[j];
-                                if (music.ServerClientType == 1)
-                                {
-                                    continue;
-                                }
-                                System.Threading.Thread.Sleep(500);
                                 //姣忎釜500姣鍙戜粠鎾斁鍣ㄩ煶閲忓懡浠�
                                 SendMethod.ControlVolume(endVolume, music);
+                                System.Threading.Thread.Sleep(1000);
+
                             }
                         }
+                        else if (if_volume == "Volume")
+                        {
+                            if (currVolumePlay == null)
+                            {
+                                continue;
+                            }
+                            SendMethod.ControlVolume(endVolume, currVolumePlay);
+                        }
+
 
                     }
                 }

--
Gitblit v1.8.0