| | |
| | | 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秒定时更新状态 |
| | |
| | | playView.viewFrameLayout(middLayout); |
| | | #endregion |
| | | |
| | | |
| | | ///切换播放模式点击事件; |
| | | playView.playOrderBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | string msg = Language.StringByID(StringId.switchTo); |
| | | switch (A31MusicModel.Current.A31PlayStatus.loop) |
| | | { |
| | | //0列表循环,1单曲循环,2随机播放; |
| | | case "0": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "1"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png"; |
| | | msg += Language.StringByID(StringId.singleMode); |
| | | break; |
| | | |
| | | case "1": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "2"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png"; |
| | | msg += Language.StringByID(StringId.randomMode); |
| | | break; |
| | | case "2": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "0"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png"; |
| | | msg += Language.StringByID(StringId.listMode); |
| | | break; |
| | | } |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false,1000); |
| | | string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop; |
| | | SendMethod.SendCommand(url); |
| | | }; |
| | | ///添加喜爱点击事件; |
| | | playView.loveBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | |
| | | } |
| | | 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) => |
| | | { |
| | | string msg = Language.StringByID(StringId.switchTo); |
| | | switch (A31MusicModel.Current.A31PlayStatus.loop) |
| | | { |
| | | //0列表循环,1单曲循环,2随机播放; |
| | | case "0": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "1"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png"; |
| | | msg += Language.StringByID(StringId.singleMode); |
| | | break; |
| | | |
| | | case "1": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "2"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png"; |
| | | msg += Language.StringByID(StringId.randomMode); |
| | | break; |
| | | case "2": |
| | | A31MusicModel.Current.A31PlayStatus.loop = "0"; |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png"; |
| | | msg += Language.StringByID(StringId.listMode); |
| | | break; |
| | | } |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false); |
| | | string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop; |
| | | SendMethod.SendCommand(url); |
| | | }; |
| | | ///我的列表点击事件 |
| | | playView.playlistBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | ///移除界面 |
| | | 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; |
| | |
| | | { |
| | | if (A31MusicModel.Current.ServerClientType == 1 && A31MusicModel.Current.Slave.slave_list.Count != 0) |
| | | { ///主播放器 |
| | | new View.DialogView { }.PlayerVolumeView(A31MusicModel.Current); |
| | | //new View.DialogView { }.PlayerVolumeView(A31MusicModel.Current); |
| | | |
| | | var volumeView = new View.DialogView { }; |
| | | volumeView.PlayerVolumeView(A31MusicModel.Current); |
| | | volumeView.UpdateVolume(); |
| | | |
| | | } |
| | | }; |
| | | ///音量进度条点击事件 |
| | | int startVolume =0;//之前的音量 |
| | | //int endVolume = 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; |
| | |
| | | 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(); |
| | | } |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | System.Threading.Thread timerThread; |
| | | /// <summary> |
| | | /// 定时更新状态 |
| | |
| | | //更新播放器音量给系统音量 |
| | | Volume.MusicVolume = playView.volSeekBar.Progress; |
| | | //当前播放音乐时间 |
| | | int playSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.curpos) / 1000+(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; |
| | | |
| | | int playSecond = int.Parse(A31MusicModel.Current.A31PlayStatus.curpos) / 1000 + (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; |
| | | |
| | | int playMusicMinute = playSecond / 60; |
| | | //秒钟 |
| | | int playMusicSecond = playSecond % 60; |
| | |
| | | ///点击播放事件 |
| | | 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(() => |
| | | { |