From a1f2f085e9a2790daecdb5a12d1075b64b2a3d92 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 24 一月 2022 11:45:43 +0800
Subject: [PATCH] 备份

---
 HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs |  273 +++++++++++++++++++++++++++---------------------------
 1 files changed, 138 insertions(+), 135 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index 284aadc..39f941d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -3,6 +3,7 @@
 using com.hdl.on;
 using System.Collections.Generic;
 using System.Security;
+using HDL_ON.UI.UI2.FuntionControlView.Music;
 
 namespace HDL_ON.UI.Music
 {
@@ -36,17 +37,19 @@
         /// new甯冨眬鐣岄潰
         /// </summary>
         View.PlayView playView = new View.PlayView();
-       
+        TopView topView;
+
+
         public void Show()
         {
+
             ///1绉掑畾鏃舵洿鏂扮姸鎬�
             timerUpdateStatus();
             #region   ---鐣岄潰甯冨眬---
             this.BackgroundColor = MusicColor.ViewColor;
-            var topView = new TopView();
+            topView = new TopView();
             topView.setBtn.Visible = true;
             this.AddChidren(topView.TopFLayoutView());
-            topView.topNameBtn.Text = A31MusicModel.Current.Name;
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
                 RemoveFromParent();
@@ -67,7 +70,8 @@
             ///鍔犺浇鎾斁闊充箰鐣岄潰鐨勬帶浠舵柟娉�
             playView.viewFrameLayout(middLayout);
             #endregion
-            #region   ---鎺т欢鐨勭偣鍑讳簨浠�---
+
+            #region   ---鐣岄潰鐐瑰嚮浜嬩欢---
             //鏀惰棌鍥炬爣浜嬩欢
             playView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
             {
@@ -82,52 +86,35 @@
                 }
 
             };
-            //蹇繘婊戝姩寮硅捣浜嬩欢;
-            playView.diyArcSeekBar.OnStopTrackingTouchEvent+= (sender, e) =>
-            {
-                int totalSecond = (int)(playView.diyArcSeekBar.Progress * 1.0f / 100 * int.Parse(A31MusicModel.Current.functionMusic.GetAttrState("song_time")));
-                //鍒嗛挓
-                int Minute = totalSecond / 60;
-                //绉掗挓
-                int Second = totalSecond % 60;
-                string time = "00" + ":" + (Minute.ToString().Length < 2 ? "0" + Minute.ToString() : Minute.ToString()) + ":" + (Second.ToString().Length < 2 ? "0" + Second.ToString() : Second.ToString());
-                //SendMethod.Seek(time, A31MusicModel.Current);
-
-                //Dictionary<string, string> dic = new Dictionary<string, string>();
-                //dic.Add("mode", modeValueString);
-                //SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
-                A31MusicModel.Current.A31PlayStatus.curpos = (DateTime.Parse(time) - DateTime.Parse("00:00:00")).TotalMilliseconds.ToString();
-            };
             ///鍒囨崲鎾斁妯″紡鐐瑰嚮浜嬩欢;
             playView.playOrderBtn.MouseUpEventHandler += (sender, e) =>
              {
                  string modeValueString = string.Empty; 
                  string msg = Language.StringByID(StringId.switchTo);
-                 switch (A31MusicModel.Current.A31PlayStatus.loop)
+                 switch (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode))
                  {
                      //list_cycle鍒楄〃寰幆锛宻ingle_cycle鍗曟洸寰幆锛宺andom闅忔満鎾斁;
-                     case "list_cycle":
-                         modeValueString="single_cycle";
+                     case ValueProperty.list_cycle:
+                         modeValueString=ValueProperty.single_cycle;
                          playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
                          msg += Language.StringByID(StringId.singleMode);
                          break;
-
-                     case "single_cycle":
-                         modeValueString = "random";
+                     case ValueProperty.single_cycle:
+                         modeValueString =ValueProperty.random;
                          playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
                          msg += Language.StringByID(StringId.randomMode);
                          break;
-                     case "random":
-                         modeValueString = "list_cycle";
+                     case ValueProperty.random:
+                         modeValueString = ValueProperty.list_cycle;
                          playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
                          msg += Language.StringByID(StringId.listMode);
                          break;
                  }
-                 A31MusicModel.Current.functionMusic.SetAttrState("mode", modeValueString);
+                 A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.mode, modeValueString);
                  new PublicAssmebly().TipMsgAutoClose(msg, false,1000);
                  Dictionary<string, string> dic = new Dictionary<string, string>();
-                 dic.Add("mode",modeValueString);
-                 SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic,dic);
+                 dic.Add(KeyProperty.mode,modeValueString);
+                 SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic,dic);
              };
             ///娣诲姞鍠滅埍鐐瑰嚮浜嬩欢;
             playView.loveBtn.MouseUpEventHandler += (sender, e) =>
@@ -135,49 +122,24 @@
 
                 var name = A31MusicModel.Current.functionMusic.GetAttribute("song_name").ToString();
                 var songTime = A31MusicModel.Current.functionMusic.GetAttribute("song_time").ToString();
-                if (A31MusicModel.Current.A31PlayStatus.Source == "RADIO-NETWORK")
+                playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
+                if (playView.loveBtn.IsSelected)
                 {
-                    playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
-                    if (playView.loveBtn.IsSelected)
+                    if (null == A31MusicModel.Current.LoveMusicInfoList.Find((musicInfo) =>
                     {
-                        if (null == A31MusicModel.Current.LoveRadioInfoList.Find((musicInfo) =>
-                        {
-                            return name == musicInfo.name;
-                        }))
-                        {
-                            A31MusicModel.Current.LoveRadioInfoList.Add(new Songs { name = name, time = songTime});
-                        }
-                    }
-                    else
+                        return name == musicInfo.name;
+                    }))
                     {
-                        A31MusicModel.Current.LoveRadioInfoList.RemoveAll((musicInfo) =>
-                        {
-                            return name == musicInfo.name;
-                        });
+                        A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime });
                     }
                 }
                 else
                 {
-                    playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
-                    if (playView.loveBtn.IsSelected)
+                    A31MusicModel.Current.LoveMusicInfoList.RemoveAll((musicInfo) =>
                     {
-                        if (null == A31MusicModel.Current.LoveMusicInfoList.Find((musicInfo) =>
-                        {
-                            return name == musicInfo.name;
-                        }))
-                        {
-                            A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime});
-                        }
-                    }
-                    else
-                    {
-                        A31MusicModel.Current.LoveMusicInfoList.RemoveAll((musicInfo) =>
-                        {
-                            //涔熻鍔犳瓕鎵嬪悕鍒ゆ柇
-                            return musicInfo.name == name;
-                        });
-                    }
-
+                        //涔熻鍔犳瓕鎵嬪悕鍒ゆ柇
+                        return musicInfo.name == name;
+                    });
                 }
                 A31MusicModel.Save();
             };
@@ -192,8 +154,34 @@
                 ///涓嬫媺鍒锋柊
                 myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
                 {
+                    System.Threading.Tasks.Task.Run(() =>
+                    {
+                        try
+                        {
+                            A31MusicModel.Current.palyLists.Clear();
+                            if (A31MusicModel.Current.palyLists.Count == 0)
+                            {
+                                SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic);
+
+                            }
+                        }
+                        catch
+                        {
+                        }
+                        finally
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                myListView.verticalScrolViewLayout.EndHeaderRefreshing();
+                                myListView.verticalScrolViewLayout.RemoveAll();
+                                var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
+                                var musicList = A31MusicModel.Current.GetSongList(listName);
+                                A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, myListView.popFra);
+                            });
+                        }
+                    });
                     //缁撴潫鍒锋柊
-                    myListView.verticalScrolViewLayout.EndHeaderRefreshing();
+                   
                 };
                 ///绉婚櫎鐣岄潰
                 EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) =>
@@ -214,13 +202,7 @@
             ///闊抽噺鍥炬爣鐐瑰嚮浜嬩欢
             playView.volIconBtn.MouseUpEventHandler += (sender, e) =>
             {
-                if (A31MusicModel.Current.ServerClientType == 1 && A31MusicModel.Current.Slave.slave_list.Count != 0)
-                { ///涓绘挱鏀惧櫒
-                    var volumeView = new View.DialogView { };
-                    volumeView.PlayerVolumeView(A31MusicModel.Current);
-                    volumeView.UpdateVolume();
-
-                }
+               
             };
             ///闊抽噺杩涘害鏉$偣鍑讳簨浠�
             int startVolume =0;//涔嬪墠鐨勯煶閲�
@@ -231,10 +213,10 @@
                 if (startVolume != e)
                 {
                     startVolume = e;
-                    A31MusicModel.Current.functionMusic.SetAttrState("volume", startVolume);
+                    A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
                     Dictionary<string, string> dic = new Dictionary<string, string>();
-                    dic.Add("volume", startVolume.ToString());
-                    SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+                    dic.Add(KeyProperty.volume, startVolume.ToString());
+                    SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
 
                 }
             };
@@ -245,10 +227,10 @@
             {
                 playView.prevBtn.IsSelected = true;
 
-                A31MusicModel.Current.functionMusic.SetAttrState("song_step", "down");
+                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down);
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                dic.Add("song_step", "down");
-                SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+                dic.Add(KeyProperty.song_step, ValueProperty.down);
+                SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
 
             };
             playView.prevBtn.MouseUpEventHandler += (sender, e) =>
@@ -262,50 +244,48 @@
                 if (playView.playBtn.IsSelected)
                 {
                     playView.playBtn.IsSelected = false;
-                    status = "off";
+                    status = ValueProperty.off; 
                 }
                 else
                 {
                     playView.playBtn.IsSelected = true;
-                    status = "on";
+                    status = ValueProperty.on;
                 }
-                A31MusicModel.Current.functionMusic.SetAttrState("on_off", status);
+                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.on_off, status);
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                dic.Add("on_off", status);
-                SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+                dic.Add(KeyProperty.on_off, status);
+                SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
             };
             ///涓嬩竴鏇茬偣鍑讳簨浠�
             playView.nextBtn.MouseDownEventHandler += (sender, e) =>
             {
                 playView.nextBtn.IsSelected = true;
-                A31MusicModel.Current.functionMusic.SetAttrState("song_step", "down");
+                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down);
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                dic.Add("song_step", "down");
-                SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+                dic.Add(KeyProperty.song_step, ValueProperty.down);
+                SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
             };
             playView.nextBtn.MouseUpEventHandler += (sender, e) =>
             {
                 playView.nextBtn.IsSelected = false;
             };
-            ///鐗╃悊鎸夐敭鐨勭偣鍑讳簨浠�
-            Volume.VolumeChange = (volume) =>
-            {
-                if (Application.DeviceType == Device.Ios && A31MusicModel.Current.A31PlayStatus.Source == "BLUETOOTH")
-                {
-                    return;
-                }
-                playView.volSeekBar.Progress = volume;
-
-                if (startVolume != volume)
-                {
-                    startVolume = volume;
-                    A31MusicModel.Current.functionMusic.SetAttrState("volume", startVolume);
-                    Dictionary<string, string> dic = new Dictionary<string, string>();
-                    dic.Add("volume", startVolume.ToString());
-                    SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
-                }
-
-            };
+            /////鐗╃悊鎸夐敭鐨勭偣鍑讳簨浠�
+            //Volume.VolumeChange = (volume) =>
+            //{
+            //    if (Application.DeviceType == Device.Ios && A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source) == "bluetooth")
+            //    {
+            //        return;
+            //    }
+            //    playView.volSeekBar.Progress = volume;
+            //    if (startVolume != volume)
+            //    {
+            //        startVolume = volume;
+            //        A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
+            //        Dictionary<string, string> dic = new Dictionary<string, string>();
+            //        dic.Add(KeyProperty.volume, startVolume.ToString());
+            //        SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
+            //    }
+            //};
             #endregion
         }
         /// <summary>
@@ -325,10 +305,9 @@
                     {
                         try
                         {
-
                             //鏇存柊鎬绘椂闂�                            
                             //鎬诲叡鏈夊灏戠
-                            int totalSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState("song_time"));
+                            int totalSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_time));
                             //鍒嗛挓
                             int totalMusicMinute = totalSecond / 60;
                             //绉掗挓
@@ -337,17 +316,17 @@
                             string totalTime = (totalMusicMinute.ToString().Length < 2 ? "0" + totalMusicMinute.ToString() : totalMusicMinute.ToString()) + ":" + (totalMusicSecond.ToString().Length < 2 ? "0" + totalMusicSecond.ToString() : totalMusicSecond.ToString());
                             playView.endTimeBtn.Text = totalTime;
 
-                            //topView.topNameBtn.Text = A31MusicModel.Current.Name;
-
-                            switch (A31MusicModel.Current.functionMusic.GetAttrState("mode"))
+                            topView.topNameBtn.Text = A31MusicModel.Current.functionMusic.name;
+                            string s = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode);
+                            switch (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode))
                             {
-                                case "list_cycle"://鍒楄〃寰幆
+                                case ValueProperty.list_cycle://鍒楄〃寰幆
                                     playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
                                     break;
-                                case "single_cycle"://鍗曟洸寰幆
+                                case ValueProperty.single_cycle://鍗曟洸寰幆
                                     playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
                                     break;
-                                case "random"://闅忔満鎾斁
+                                case ValueProperty.random://闅忔満鎾斁
                                     playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
                                     break;
                             }
@@ -412,14 +391,15 @@
                             if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds)
                             {
                                 //闊抽噺杩涘害鏉�;
-                                playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.A31PlayStatus.vol);
+                                playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume));
                                 //鏄剧ず褰撳墠闊抽噺鍊�;
-                                playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%";
+                                playView.volValueBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume) + "%";
                             }
                             //鏇存柊鎾斁鍣ㄩ煶閲忕粰绯荤粺闊抽噺
                             Volume.MusicVolume = playView.volSeekBar.Progress;
-                            //褰撳墠鎾斁闊充箰鏃堕棿        
-                            int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState("playing_time"))+ (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
+                            //褰撳墠鎾斁闊充箰鏃堕棿
+                            //鎸夐亾鐞嗕笉浼氫负绌猴紝GetAttrState("playing_time")鍊煎彲鑳戒负绌猴紝寮哄埗杞崲int.Parse(锛変細鍑虹幇寮傚父锛屼笉杩囦篃鍋氫簡寮傚父澶勭悊浜�
+                            int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time))+ (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
 
                             int playMusicMinute = playSecond / 60;
                             //绉掗挓
@@ -427,7 +407,7 @@
 
                             string playTime = (playMusicMinute.ToString().Length < 2 ? "0" + playMusicMinute.ToString() : playMusicMinute.ToString()) + ":" + (playMusicSecond.ToString().Length < 2 ? "0" + playMusicSecond.ToString() : playMusicSecond.ToString());
 
-                            if (A31MusicModel.Current.functionMusic.GetAttrState("on_off") == "on")
+                            if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
                             {
                                 playView.playBtn.IsSelected = true;
                                 //濡傛灉鍦ㄦ挱鏀撅紝鏃堕棿灏变笉鏂彉鍖�                    
@@ -443,6 +423,7 @@
                                     playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
                                 }
 
+
                             }
                             else
                             {
@@ -450,8 +431,8 @@
                                 //鍋滄鎾斁
                                 playView.startTimeBtn.Text =playTime;
                             }
-                            playView.songNameTextView.Text = A31MusicModel.Current.functionMusic.GetAttrState("song_name") == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState("song_name");
-                            playView.singerBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState("song_name") == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState("song_name");
+                            playView.songNameTextView.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
+                            playView.singerBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
                             //鏇存柊婧愮殑鐣岄潰
                            // showSourcePage();
                         }
@@ -491,16 +472,7 @@
 
             switch (A31MusicModel.Current.functionMusic.GetAttrState("source"))
             {
-
-                case "QPLAY"://QQ闊充箰
-                    playView.loveBtn.Alpha = 0.5f;
-                    playView.loveBtn.Enable = false;
-                    break;
-                case "AIRPLAY"://閰风嫍闊充箰
-                    playView.loveBtn.Alpha = 0.5f;
-                    playView.loveBtn.Enable = false;
-                    playView.diyArcSeekBar.IsClickable = false;
-                    break;
+                //sdcard/audio_in/ftp/radio/bluetooth
                 case "SONGLIST-NETWORK"://鏈湴闊充箰
                     break;
                 case "SONGLIST-LOCAL"://USB
@@ -562,17 +534,48 @@
         void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout)
         {
             verticalScrolViewLayout.RemoveAll();
-            var listName = A31MusicModel.Current.functionMusic.GetAttribute("playlist_name").ToString();
+            var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
             var musicList = A31MusicModel.Current.GetSongList(listName);
-            UI2.FuntionControlView.Music.UpdateThread.PlayMusicClick(verticalScrolViewLayout,"鎾斁鍒楄〃", listName, musicList, frameLayout);
+            if (musicList.Count == 0)
+            {
+                System.Threading.Tasks.Task.Run(() =>
+                {
+                    try
+                    {
+                        A31MusicModel.Current.palyLists.Clear();
+                        if (A31MusicModel.Current.palyLists.Count == 0)
+                        {
+                            SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic);
+
+                        }
+                    }
+                    catch
+                    {
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            musicList = A31MusicModel.Current.GetSongList(listName);
+                            A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout);
+                        });
+                    }
+                });
+            }
+            else
+            {
+                A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout);
+            }
         }
         /// <summary>
         /// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰
         /// </summary>
         void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout)
         {
-            UI2.FuntionControlView.Music.UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current);
+            UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current);
         }
+
      
+
     }
 }

--
Gitblit v1.8.0