From 544c4f40fe66dd03d8e014a3a0ff74c2801e9abc Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 08 六月 2020 15:22:10 +0800 Subject: [PATCH] 2020-06-08-2 --- HDL_ON/UI/Music/A31PlayMusicPage.cs | 97 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 76 insertions(+), 21 deletions(-) diff --git a/HDL_ON/UI/Music/A31PlayMusicPage.cs b/HDL_ON/UI/Music/A31PlayMusicPage.cs index 0f9f6a9..7805a56 100644 --- a/HDL_ON/UI/Music/A31PlayMusicPage.cs +++ b/HDL_ON/UI/Music/A31PlayMusicPage.cs @@ -14,10 +14,23 @@ public override void RemoveFromParent() { base.RemoveFromParent(); - timerThread?.Abort(); Volume.VolumeChange = null; + if (timerThread != null) + { + try + { + if (timerThread.IsAlive) + { + timerThread.Abort(); + } + } + catch { } + } + } View.PlayView playView = new View.PlayView(); + + public void Show() { ///1绉掑畾鏃舵洿鏂扮姸鎬� @@ -104,11 +117,6 @@ } A31MusicModel.Save(); - - ////淇濆瓨 - //string saveRoomUIName = "A31_" + A31MusicModel.Current.IPAddress; - //Shared.IO.FileUtils.WriteFileByBytes(saveRoomUIName, - //Shared.SimpleControl.CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(A31MusicModel.Current))); }; ///鍒囨崲鎾斁妯″紡鐐瑰嚮浜嬩欢; playView.playOrderBtn.MouseUpEventHandler += (sender, e) => @@ -234,11 +242,20 @@ ///绉婚櫎鐣岄潰 EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) => { - if (updateSelectedMusicThread != null && updateSelectedMusicThread.IsAlive) + + if (updateSelectedMusicThread != null) { - updateSelectedMusicThread.Abort(); - ///鍏抽棴绾跨▼ + try + { + if (updateSelectedMusicThread.IsAlive) + { + updateSelectedMusicThread.Abort(); + ///鍏抽棴绾跨▼ + } + } + catch { } } + popFra.RemoveFromParent(); }; backIextBtn.MouseUpEventHandler += removeFromParentView; @@ -313,12 +330,30 @@ }); }; + ///闊抽噺鍥炬爣鐐瑰嚮浜嬩欢 + playView.volIconBtn.MouseUpEventHandler += (sender, e) => + { + if (A31MusicModel.Current.ServerClientType == 1 && A31MusicModel.Current.Slave.slave_list.Count != 0) + { ///涓绘挱鏀惧櫒 + //new View.DialogView { }.PlayerVolumeView(A31MusicModel.Current); + + var volumeView = new View.DialogView { }; + volumeView.PlayerVolumeView(A31MusicModel.Current); + volumeView.UpdateVolume(); + + } + }; ///闊抽噺杩涘害鏉$偣鍑讳簨浠� + int startVolume =0;//涔嬪墠鐨勯煶閲� EventHandler<int> progressClick = (sender, e) => { playView.volValueBtn.Text = playView.volSeekBar.Progress + "%"; - SendMethod.ControlVolume(playView.volSeekBar.Progress, A31MusicModel.Current); - A31MusicModel.Current.A31PlayStatus.vol = playView.volSeekBar.Progress.ToString(); + if (startVolume != e) + { + startVolume = e; + SendMethod.ControlVolume(e, A31MusicModel.Current); + A31MusicModel.Current.A31PlayStatus.vol = e.ToString(); + } }; playView.volSeekBar.OnProgressChangedEvent += progressClick; playView.volSeekBar.OnStopTrackingTouchEvent += progressClick; @@ -331,7 +366,7 @@ playView.prevBtn.MouseUpEventHandler += (sender, e) => { playView.prevBtn.IsSelected = false; - }; + }; ///鏆傚仠/鎾斁鐐瑰嚮浜嬩欢 playView.playBtn.MouseDownEventHandler += (sender, e) => { @@ -366,8 +401,14 @@ return; } playView.volSeekBar.Progress = volume; - SendMethod.ControlVolume(playView.volSeekBar.Progress, A31MusicModel.Current); - A31MusicModel.Current.A31PlayStatus.vol = playView.volSeekBar.Progress.ToString(); + + if (startVolume != volume) + { + startVolume = volume; + SendMethod.ControlVolume(volume, A31MusicModel.Current); + A31MusicModel.Current.A31PlayStatus.vol = volume.ToString(); + } + }; } @@ -381,6 +422,13 @@ { while (true) { + //if (startVolume != endVolume) + //{ + // startVolume = endVolume; + // SendMethod.ControlVolume(endVolume, A31MusicModel.Current); + // A31MusicModel.Current.A31PlayStatus.vol = endVolume.ToString(); + //} + Application.RunOnMainThread(() => { try @@ -472,9 +520,8 @@ //鏇存柊鎾斁鍣ㄩ煶閲忕粰绯荤粺闊抽噺 Volume.MusicVolume = playView.volSeekBar.Progress; //褰撳墠鎾斁闊充箰鏃堕棿 - int playSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.curpos) / 1000;// + (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; - //currentMusiceA31.musicPalyTime = (playSecond*10).ToString(); - //鍒嗛挓 + int playSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.curpos) / 1000+(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; + int playMusicMinute = playSecond / 60; //绉掗挓 int playMusicSecond = playSecond % 60; @@ -764,10 +811,17 @@ ///鐐瑰嚮鎾斁浜嬩欢 clickBtn.MouseUpEventHandler += (sender, e) => { - if (updateSelectedMusicThread != null && updateSelectedMusicThread.IsAlive) + if (updateSelectedMusicThread != null) { - updateSelectedMusicThread.Abort(); - ///鍏抽棴绾跨▼ + try + { + if (updateSelectedMusicThread.IsAlive) + { + updateSelectedMusicThread.Abort(); + ///鍏抽棴绾跨▼ + } + } + catch { } } System.Threading.Tasks.Task.Run(() => { @@ -833,7 +887,8 @@ }); } - }); + }) + { IsBackground = true }; updateSelectedMusicThread.Start(); } } -- Gitblit v1.8.0