| | |
| | | { |
| | | string modeValueString = string.Empty; |
| | | string msg = Language.StringByID(StringId.switchTo); |
| | | switch (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode)) |
| | | string modeKeyValue = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode); |
| | | switch (modeKeyValue) |
| | | { |
| | | //list_cycle列表循环,single_cycle单曲循环,random随机播放; |
| | | case ValueProperty.list_cycle: |
| | |
| | | playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png"; |
| | | msg += Language.StringByID(StringId.listMode); |
| | | break; |
| | | |
| | | } |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.mode, modeValueString); |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false,1000); |
| | |
| | | playView.volValueBtn.Text = playView.volSeekBar.Progress + "%"; |
| | | if (startVolume != e) |
| | | { |
| | | ///更新最新值 |
| | | A31MusicModel.ProgressDateTime = DateTime.Now; |
| | | startVolume = e; |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | |
| | | { |
| | | playView.playBtn.IsSelected = false; |
| | | status = ValueProperty.off; |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | // playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%"; |
| | | // } |
| | | //} |
| | | |
| | | if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds) |
| | | //为了防止音量条跳动,延长更新时间(多加1s) |
| | | 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) + "%"; |
| | | } |
| | | //更新播放器音量给系统音量 |
| | | Volume.MusicVolume = playView.volSeekBar.Progress; |
| | | //Volume.MusicVolume = playView.volSeekBar.Progress; |
| | | //当前播放音乐时间 |
| | | //按道理不会为空,GetAttrState("playing_time")值可能为空,强制转换int.Parse()会出现异常,不过也做了异常处理了 |
| | | int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time))+ (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; |
| | | |
| | | int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time)); |
| | | //识别音乐状态是否在播放状态 |
| | | if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on) |
| | | { |
| | | //音乐在播放时,再计算播放时间(现在时间=原来时间+1秒) |
| | | playSecond +=(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds; |
| | | ///歌曲记录暂时时间写入缓存; |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.playing_time, playSecond); |
| | | } |
| | | if (playSecond<=0) |
| | | { |
| | | ///播放时间不能小于0; |
| | | playSecond = 0; |
| | | } |
| | | if (playSecond >=totalSecond) |
| | | { |
| | | ///播放时间不能超过总时间; |
| | | playSecond = totalSecond; |
| | | } |
| | | int playMusicMinute = playSecond / 60; |
| | | //秒钟 |
| | | int playMusicSecond = playSecond % 60; |
| | | |
| | | 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(KeyProperty.on_off) == ValueProperty.on) |
| | |
| | | playView.playBtn.IsSelected = false; |
| | | //停止播放 |
| | | playView.startTimeBtn.Text =playTime; |
| | | //playView.startTimeBtn.Text ="00:00"; |
| | | ///歌曲记录暂停时间;<LastDateTime 计算时间播放时间有用到> |
| | | A31MusicModel.Current.LastDateTime = DateTime.Now; |
| | | } |
| | | 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); |