From c484347d42f8c14f03f498e689069a14a45abc93 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 03 二月 2023 17:56:45 +0800 Subject: [PATCH] 2023年02月03日17:56:24 --- HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 127 +++++++++++++++++++++--------------------- 1 files changed, 63 insertions(+), 64 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs index 6bcea7c..46a2a47 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs @@ -39,13 +39,11 @@ /// </summary> View.PlayView playView = new View.PlayView(); TopView topView; - - public void Show() { ///1绉掑畾鏃舵洿鏂扮姸鎬� - timerUpdateStatus(); + TimerUpdateStatus(); #region ---鐣岄潰甯冨眬--- this.BackgroundColor = MusicColor.ViewColor; topView = new TopView(); @@ -96,15 +94,16 @@ string currModeKeyValue = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode); //鑾峰彇闊充箰鎾斁妯″紡鍒楄〃 var attributes = A31MusicModel.Current.functionMusic.GetAttribute(KeyProperty.mode); - if (attributes==null) { - attributes=new FunctionAttributes(); + if (attributes == null) + { + attributes = new FunctionAttributes(); } var attributesList = attributes.value; //鎵惧埌褰撳墠鎾斁妯″紡绱㈠紩鍊� int currModeIndexe = attributesList.IndexOf(currModeKeyValue); //璁板綍閫変腑鐨勬挱鏀炬ā寮忕殑绱㈠紩鍊� int count = 0; - if (currModeIndexe >= attributesList.Count-1) + if (currModeIndexe >= attributesList.Count - 1) { //閲嶇疆绱㈠紩鍊� count = 0; @@ -119,7 +118,7 @@ { //list_cycle鍒楄〃寰幆锛宻ingle_cycle鍗曟洸寰幆锛宺andom闅忔満鎾斁; case ValueProperty.list_cycle: - playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png"; + playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png"; msg += Language.StringByID(StringId.listMode); break; case ValueProperty.single_cycle: @@ -146,7 +145,7 @@ Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add(KeyProperty.mode, modeValueString); //鍙戦�佹帶鍒舵寚浠� - SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }; ///娣诲姞鍠滅埍鐐瑰嚮浜嬩欢; playView.loveBtn.MouseUpEventHandler += (sender, e) => @@ -162,7 +161,7 @@ return name == musicInfo.name; })) { - A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime }); + A31MusicModel.Current.LoveMusicInfoList.Add(new SongInfo { name = name, time = songTime }); } } else @@ -186,14 +185,14 @@ ///涓嬫媺鍒锋柊 myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () => { - System.Threading.Tasks.Task.Run(() => + System.Threading.Tasks.Task.Run((Action)(() => { try { - A31MusicModel.Current.palyLists.Clear(); - if (A31MusicModel.Current.palyLists.Count == 0) + A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); + if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) { - SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic); + SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic); } } @@ -207,13 +206,15 @@ myListView.verticalScrolViewLayout.EndHeaderRefreshing(); myListView.verticalScrolViewLayout.RemoveAll(); var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); + var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); var musicList = A31MusicModel.Current.GetSongList(listName); - A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, myListView.popFra); + + A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra); }); } - }); + })); //缁撴潫鍒锋柊 - + }; ///绉婚櫎鐣岄潰 EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) => @@ -234,10 +235,10 @@ ///闊抽噺鍥炬爣鐐瑰嚮浜嬩欢 playView.volIconBtn.MouseUpEventHandler += (sender, e) => { - + }; ///闊抽噺杩涘害鏉$偣鍑讳簨浠� - int startVolume =0;//涔嬪墠鐨勯煶閲� + int startVolume = 0;//涔嬪墠鐨勯煶閲� //int endVolume = 0;//鐜板湪鐨勯煶閲� EventHandler<int> progressClick = (sender, e) => { @@ -250,7 +251,7 @@ 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); + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); } }; @@ -261,16 +262,16 @@ { playView.prevBtn.IsSelected = true; - A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down); + A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down); Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add(KeyProperty.song_step, ValueProperty.up); - SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }; playView.prevBtn.MouseUpEventHandler += (sender, e) => { playView.prevBtn.IsSelected = false; - }; + }; ///鏆傚仠/鎾斁鐐瑰嚮浜嬩欢 playView.playBtn.MouseDownEventHandler += (sender, e) => { @@ -279,7 +280,7 @@ { playView.playBtn.IsSelected = false; status = ValueProperty.off; - + } else { @@ -289,16 +290,16 @@ A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.on_off, status); Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add(KeyProperty.on_off, status); - SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }; ///涓嬩竴鏇茬偣鍑讳簨浠� playView.nextBtn.MouseDownEventHandler += (sender, e) => { playView.nextBtn.IsSelected = true; - A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step,ValueProperty.down); + A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down); Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add(KeyProperty.song_step, ValueProperty.down); - SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }; playView.nextBtn.MouseUpEventHandler += (sender, e) => { @@ -330,7 +331,7 @@ /// <summary> /// 瀹氭椂鏇存柊鐘舵�� /// </summary> - void timerUpdateStatus() + void TimerUpdateStatus() { timerThread = new System.Threading.Thread((obj) => { @@ -406,13 +407,15 @@ //} //鏄剧ず鎾斁鍣ㄥ尯鍩� playView.regionBtn.Text = A31MusicModel.Current.functionMusic.GetRoomListName(); - //鏄剧ず鎾斁鍣ㄦ敹钘忕姸鎬佸浘鏍� + //鏄剧ず鎾斁鍣ㄦ敹钘忕姸鎬� if (A31MusicModel.Current.functionMusic.collect) { + //鏀惰棌 playView.collectIconBtn.IsSelected = true; } else { + //涓嶆敹钘� playView.collectIconBtn.IsSelected = false; } //if (A31MusicModel.Current.A31PlayStatus.IsMute) @@ -432,9 +435,9 @@ // } //} //涓轰簡闃叉闊抽噺鏉¤烦鍔�,寤堕暱鏇存柊鏃堕棿(澶氬姞1s) - if (2000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds || A31MusicModel.ProgressDateTime==DateTime.MinValue) + if (2000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds || A31MusicModel.ProgressDateTime == DateTime.MinValue) { - //闊抽噺杩涘害鏉�; + //鏄剧ず闊抽噺杩涘害鏉″��; playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume)); //鏄剧ず褰撳墠闊抽噺鍊�; playView.volValueBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume) + "%"; @@ -448,17 +451,17 @@ if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on) { //闊充箰鍦ㄦ挱鏀炬椂锛屽啀璁$畻鎾斁鏃堕棿(鐜板湪鏃堕棿=鍘熸潵鏃堕棿+1绉�) - playSecond +=(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; + playSecond += (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; playSecond += 1;//琛ㄧず鍔犱笂绛夊緟鐨勬椂闂�1s ///姝屾洸璁板綍鏆傛椂鏃堕棿鍐欏叆缂撳瓨锛� A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.playing_time, playSecond); } - if (playSecond<=0) + if (playSecond <= 0) { ///鎾斁鏃堕棿涓嶈兘灏忎簬0锛� playSecond = 0; } - if (playSecond >=totalSecond) + if (playSecond >= totalSecond) { ///鎾斁鏃堕棿涓嶈兘瓒呰繃鎬绘椂闂达紱 playSecond = totalSecond; @@ -468,42 +471,38 @@ int playMusicSecond = playSecond % 60; //杞寲鎾斁鏃堕棿鏃堕棿鏍煎紡 string playTime = (playMusicMinute.ToString().Length < 2 ? "0" + playMusicMinute.ToString() : playMusicMinute.ToString()) + ":" + (playMusicSecond.ToString().Length < 2 ? "0" + playMusicSecond.ToString() : playMusicSecond.ToString()); - + //鏄剧ず鎾斁鏃堕棿 + playView.startTimeBtn.Text = playTime; + //鏄剧ず鎾斁鐘舵�� if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on) { - //鏄剧ず鎾斁鐘舵�佸浘鏍� + //鎾斁 playView.playBtn.IsSelected = true; - //鏄剧ず鎾斁鏃堕棿 - playView.startTimeBtn.Text = playTime; - if (totalSecond == 0) - { - //鏄剧ず姝屾洸杩涘害鏉� - playView.diyArcSeekBar.Progress = 0; - } - else - { - //鏄剧ず姝屾洸杩涘害鏉� - playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1 - } - - } else { - //鏄剧ず鎾斁鐘舵�佸浘鏍� + //鏆傚仠 playView.playBtn.IsSelected = false; - //鍋滄鎾斁 - playView.startTimeBtn.Text =playTime; - //playView.startTimeBtn.Text ="00:00"; ///璁板綍姝屾洸鏆傚仠鏃堕棿锛�<LastDateTime 璁$畻鎾斁鏃堕棿鏈夌敤鍒�> A31MusicModel.Current.LastDateTime = DateTime.Now; + } + //鏄剧ず杩涘害鏉″�� + if (totalSecond == 0) + { + //姝屾洸鎾斁杩涘害 + playView.diyArcSeekBar.Progress = 0; + } + else + { + //姝屾洸鎾斁杩涘害 + playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1 } //鏄剧ず姝屾洸鍚嶇О 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(); + // showSourcePage(); } catch (Exception e) { @@ -604,17 +603,20 @@ { verticalScrolViewLayout.RemoveAll(); var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); + var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); + //鑾峰彇缂撳瓨姝屾洸鍒楄〃 var musicList = A31MusicModel.Current.GetSongList(listName); if (musicList.Count == 0) { - System.Threading.Tasks.Task.Run(() => + System.Threading.Tasks.Task.Run((Action)(() => { try { - A31MusicModel.Current.palyLists.Clear(); - if (A31MusicModel.Current.palyLists.Count == 0) + A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); + if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) { - SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic); + //鑾峰彇姝屾洸鍒楄〃 + SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic); } } @@ -626,14 +628,14 @@ Application.RunOnMainThread(() => { musicList = A31MusicModel.Current.GetSongList(listName); - A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); + A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); }); } - }); + })); } else { - A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); + A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); } } /// <summary> @@ -643,8 +645,5 @@ { UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current); } - - - } } -- Gitblit v1.8.0