using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using Shared;
|
using Shared.SimpleControl.Phone;
|
using Shared.SimpleControl;
|
using Shared.SimpleControl.R;
|
using Newtonsoft.Json.Linq;
|
using com.hdl.on;
|
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class SonosPlay : FrameLayout
|
{
|
void showSourcePage ()
|
{
|
|
prev.Alpha = 1;
|
prev.Enable = true;
|
|
next.Alpha = 1;
|
next.Enable = true;
|
|
mode.Alpha = 1;
|
mode.Enable = true;
|
|
btnPlay.Alpha = 1;
|
btnPlay.Enable = true;
|
|
btnMute.Alpha = 1;
|
btnMute.Enable = true;
|
|
|
|
SeekBarVol.IsCanMove = true;
|
SeekBarVol.Alpha = 1;
|
|
|
|
if (currentSonosMusic.sonosPlayStatus.playbackState == 4) {
|
prev.Alpha = 0.5f;
|
prev.Enable = false;
|
|
next.Alpha = 0.5f;
|
next.Enable = false;
|
|
mode.Alpha = 0.5f;
|
mode.Enable = false;
|
|
btnPlay.Alpha = 0.5f;
|
btnPlay.Enable = false;
|
|
|
btnMute.Alpha = 0.5f;
|
btnMute.Enable = false;
|
|
|
|
SeekBarVol.Alpha = 0.5f;
|
SeekBarVol.IsCanMove = false;
|
|
|
|
}
|
|
}
|
/// <summary>
|
/// 下一曲
|
/// </summary>
|
Button next;
|
/// <summary>
|
/// 上一曲
|
/// </summary>
|
Button prev;
|
/// <summary>
|
/// 停止/播放
|
/// </summary>
|
Button btnPlay;
|
/// <summary>
|
///当前播放音乐时间
|
/// </summary>
|
Button btnMusicplayTime;
|
/// <summary>
|
/// 音乐总时间
|
/// </summary>
|
Button btnTotalMusicTime;
|
/// <summary>
|
/// 播放音乐时间进度条
|
/// </summary>
|
// Button progressMaxButton;
|
/// <summary>
|
/// 播放进度
|
/// </summary>
|
//Button progressButton;
|
/// <summary>
|
/// 歌名
|
/// </summary>
|
TextView title;
|
|
/// <summary>
|
/// 静音图标
|
/// </summary>
|
Button btnMute;
|
Button btnMusicvol;
|
/// <summary>
|
/// 当前音量进度条
|
/// </summary>
|
HorizontalSeekBar horizontalSeekBarVol;
|
/// <summary>
|
/// 快进进度条
|
/// </summary>
|
HorizontalSeekBar SeekBarVol;
|
/// <summary>
|
/// 播放模式:0列表循环,1单曲循环,2随机播放
|
/// </summary>
|
Button mode;
|
/// <summary>
|
/// 当前音乐播放器的名称
|
/// </summary>
|
Button setName;
|
/// <summary>
|
/// 歌手头像
|
/// </summary>
|
Button musicartist;
|
/// <summary>
|
/// 当前播放源图标
|
/// </summary>
|
Button currentsource;
|
/// <summary>
|
/// 当前歌手图像
|
/// </summary>
|
ImageView portrait;
|
|
FrameLayout middleFrameLayout = new FrameLayout ();
|
|
SonosMusic currentSonosMusic;
|
/// <summary>
|
/// 加载音乐播放界面
|
/// </summary>
|
public void Show (SonosMusic sonosMusic)
|
{
|
this.currentSonosMusic = sonosMusic;
|
|
//读取当前的音乐状态
|
readStatus ();
|
|
AddChidren (new Button {
|
Height = Application.GetRealHeight (30),
|
BackgroundColor = SkinStyle.Current.MusicTopFrameLayout,
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (30),
|
BackgroundColor = SkinStyle.Current.MusicTopFrameLayout,
|
};
|
AddChidren (topFrameLayout);
|
|
setName = new Button {
|
TextColor = SkinStyle.Current.MusicTextColor,
|
|
};
|
topFrameLayout.AddChidren (setName);
|
|
var back = new Button {
|
Width = Application.GetMinRealAverage (72),
|
Height = Application.GetMinRealAverage (89),
|
X = Application.GetRealWidth (-1),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayBack.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
};
|
|
var set = new Button {
|
Width = Application.GetRealWidth (76),
|
Height = Application.GetRealHeight (66),
|
X = Application.GetRealWidth (550),
|
UnSelectedImagePath = "MusicIcon/PlayMusicset.png",
|
Gravity = Gravity.CenterVertical,
|
Tag = currentSonosMusic,
|
};
|
topFrameLayout.AddChidren (set);
|
set.MouseDownEventHandler += (sender, e) => {
|
var sonosMusicSource = new SonosMusicSource ();
|
MainPage.MainFrameLayout.AddChidren (sonosMusicSource);
|
sonosMusicSource.Show (currentSonosMusic);
|
};
|
|
middleFrameLayout.Width = LayoutParams.MatchParent;
|
middleFrameLayout.Height = Application.GetRealHeight (1006 + 100);
|
middleFrameLayout.Y = topFrameLayout.Bottom;
|
middleFrameLayout.BackgroundImagePath = "MusicIcon/PlayBackgroun.png";
|
AddChidren (middleFrameLayout);
|
//隐藏底层
|
topFrameLayout.BringToFront ();
|
|
FrameLayout fra = new FrameLayout {
|
Y = Application.GetRealHeight (155 - 130),
|
Height = Application.GetRealHeight (106),
|
};
|
middleFrameLayout.AddChidren (fra);
|
|
|
currentsource = new Button {
|
Width = Application.GetRealWidth (61),
|
Height = Application.GetRealHeight (81),
|
X = Application.GetRealWidth (640 - 61 - 1 - 20),
|
Gravity = Gravity.CenterVertical,
|
};
|
fra.AddChidren (currentsource);
|
|
var color = new FrameLayout {
|
Width = Application.GetMinRealAverage (330),
|
Height = Application.GetMinRealAverage (330),
|
Y = Application.GetRealHeight (290 - 130),
|
BackgroundColor = 0x30FFFFFF,
|
//BackgroundImagePath = "MusicIcon/PlayPortrait.png",
|
//Animate= Animate.Rotation,
|
Radius = (uint)Application.GetMinRealAverage (165),
|
Gravity = Gravity.CenterHorizontal,
|
};
|
middleFrameLayout.AddChidren (color);
|
|
portrait = new ImageView {
|
Width = Application.GetMinRealAverage (280),
|
Height = Application.GetMinRealAverage (280),
|
Radius = (uint)Application.GetMinRealAverage (140),
|
Gravity = Gravity.Center,
|
ImagePath = "MusicIcon/PlayPortrait.png",
|
};
|
color.AddChidren (portrait);
|
|
var frameLayout2 = new FrameLayout {
|
Height = Application.GetRealHeight (103),
|
Y = Application.GetRealHeight (730 - 130),
|
};
|
middleFrameLayout.AddChidren (frameLayout2);
|
|
mode = new Button {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (82),
|
X = Application.GetRealWidth (1),
|
Gravity = Gravity.CenterVertical,
|
};
|
frameLayout2.AddChidren (mode);
|
mode.MouseDownEventHandler += Mode_MouseDownEventHandler;
|
|
title = new TextView {
|
Width = Application.GetMinRealAverage (300),
|
Height = Application.GetMinRealAverage (60),
|
X = Application.GetRealWidth (170),
|
Gravity = Gravity.CenterVertical,
|
//Gravity = Gravity.Center,
|
TextSize = 15,
|
TextColor = SkinStyle.Current.MusicTextColor
|
};
|
frameLayout2.AddChidren (title);
|
|
musicartist = new Button {
|
Width = Application.GetMinRealAverage (300),
|
Height = Application.GetMinRealAverage (60),
|
X = Application.GetRealWidth (170),
|
Y = Application.GetRealHeight (790 - 130),
|
//TextColor = 0x80ffffff,
|
TextColor = SkinStyle.Current.MusicArtistTextColor
|
};
|
middleFrameLayout.AddChidren (musicartist);
|
|
|
|
#region 歌曲时间 快,慢进度条
|
var tempFrameLayout3 = new FrameLayout {
|
Height = Application.GetRealHeight (130),
|
Y = Application.GetRealHeight (840 - 130),
|
};
|
middleFrameLayout.AddChidren (tempFrameLayout3);
|
|
btnMusicplayTime = new Button {
|
Width = Application.GetRealWidth (126),
|
Height = Application.GetRealHeight (126),
|
X = Application.GetRealWidth (1),
|
Gravity = Gravity.CenterVertical,
|
};
|
tempFrameLayout3.AddChidren (btnMusicplayTime);
|
|
btnTotalMusicTime = new Button {
|
Width = Application.GetRealWidth (126),
|
Height = Application.GetRealHeight (126),
|
X = Application.GetRealWidth (640 - 1 - 126),
|
Gravity = Gravity.CenterVertical,
|
};
|
tempFrameLayout3.AddChidren (btnTotalMusicTime);
|
|
var layout = new FrameLayout {
|
X = Application.GetRealWidth (120),
|
Width = Application.GetRealWidth (400),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterVertical,
|
Radius = (uint)Application.GetRealHeight (25),
|
};
|
tempFrameLayout3.AddChidren (layout);
|
|
//快进进度条
|
SeekBarVol = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (400 - 26),
|
Height = Application.GetRealHeight (50),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (13),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
SleepTime = 1000,
|
ThumbRadius = 3,
|
};
|
layout.AddChidren (SeekBarVol);
|
|
SeekBarVol.MouseUpEventHandler += (sender, e) => {
|
int totalSecond = (int)(SeekBarVol.Progress * 1.0f / SeekBarVol.Max * currentSonosMusic.sonosPlayStatus.durationMillis);
|
currentSonosMusic.eventsend (currentSonosMusic, 10, totalSecond);
|
currentSonosMusic.sonosPlayStatus.positionMillis = totalSecond;
|
};
|
#endregion
|
|
#region 上,下,暂停/播放
|
var tempFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (130),
|
Y = Application.GetRealHeight (960 - 130),
|
};
|
middleFrameLayout.AddChidren (tempFrameLayout);
|
|
prev = new Button {
|
Width = Application.GetMinRealAverage (126),
|
Height = Application.GetMinRealAverage (126),
|
X = Application.GetRealWidth (115),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayPrve.png",
|
SelectedImagePath = "MusicIcon/PlayPrveSelected.png",
|
};
|
tempFrameLayout.AddChidren (prev);
|
prev.MouseDownEventHandler += (sender, e) => {
|
prev.IsSelected = true;
|
currentSonosMusic.eventsend (currentSonosMusic, 2, 0);
|
};
|
prev.MouseUpEventHandler += (sender, e) => {
|
prev.IsSelected = false;
|
};
|
|
btnPlay = new Button {
|
Width = Application.GetMinRealAverage (159),
|
Height = Application.GetMinRealAverage (127),
|
X = Application.GetRealWidth (241),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/Playplay.png",
|
SelectedImagePath = "MusicIcon/playmusicplaySelected.png",
|
};
|
tempFrameLayout.AddChidren (btnPlay);
|
btnPlay.MouseDownEventHandler += (sender, e) => {
|
if (btnPlay.IsSelected) {
|
btnPlay.IsSelected = false;
|
currentSonosMusic.eventsend (currentSonosMusic, 0, 2);
|
currentSonosMusic.sonosPlayStatus.playbackState = 2;
|
} else {
|
btnPlay.IsSelected = true;
|
currentSonosMusic.eventsend (currentSonosMusic, 0, 1);
|
currentSonosMusic.sonosPlayStatus.playbackState = 1;
|
}
|
};
|
|
next = new Button {
|
Width = Application.GetMinRealAverage (126),
|
Height = Application.GetMinRealAverage (126),
|
X = Application.GetRealWidth (400),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayNext.png",
|
SelectedImagePath = "MusicIcon/PlayNextSelected.png",
|
};
|
tempFrameLayout.AddChidren (next);
|
next.MouseDownEventHandler += (sender, e) => {
|
next.IsSelected = true;
|
currentSonosMusic.eventsend (currentSonosMusic, 2, 1);
|
};
|
next.MouseUpEventHandler += (sender, e) => {
|
next.IsSelected = false;
|
};
|
#endregion
|
|
#region 静音, 音量+,-,
|
btnMute = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (1),//-2
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayMute.png",
|
SelectedImagePath = "MusicIcon/PlayMuteSelected.png",
|
};
|
tempFrameLayout.AddChidren (btnMute);
|
btnMute.MouseDownEventHandler += (sender, e) => {
|
btnMute.IsSelected = !btnMute.IsSelected;
|
if (btnMute.IsSelected) {
|
currentSonosMusic.sonosPlayStatus.mute = true;
|
currentSonosMusic.eventsend (currentSonosMusic, 29, 100);
|
} else {
|
currentSonosMusic.sonosPlayStatus.mute = false;
|
currentSonosMusic.eventsend (currentSonosMusic, 29, 111);
|
}
|
};
|
|
btnMusicvol = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (640 - 1 - 107),//534
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayVoice.png",
|
SelectedImagePath = "MusicIcon/PlayVoiceSelected.png",
|
};
|
tempFrameLayout.AddChidren (btnMusicvol);
|
btnMusicvol.MouseDownEventHandler += (sender, e) => {
|
Button button = sender as Button;
|
if (button.IsSelected) {
|
button.IsSelected = false;
|
middleFrameLayout.Y += Application.GetRealHeight (100);
|
} else {
|
button.IsSelected = true;
|
middleFrameLayout.Y -= Application.GetRealHeight (100);
|
}
|
};
|
|
var ProgFrameLayout = new FrameLayout {
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (1120 - 130),
|
};
|
middleFrameLayout.AddChidren (ProgFrameLayout);
|
|
var redbtnMusicvol = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (1),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/redvol.png",
|
SelectedImagePath = "MusicIcon/Selectedredvol.png",
|
};
|
ProgFrameLayout.AddChidren (redbtnMusicvol);
|
|
|
var addbtnMusicvo = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (640 - 108),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/addvol.png",
|
SelectedImagePath = "MusicIcon/Selectedaddvol.png",
|
};
|
ProgFrameLayout.AddChidren (addbtnMusicvo);
|
|
var frameLayout = new FrameLayout {
|
Width = Application.GetRealWidth (460),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (90),//120
|
};
|
ProgFrameLayout.AddChidren (frameLayout);
|
|
//当前播放的音量
|
horizontalSeekBarVol = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (460 - 26),//490
|
Height = Application.GetRealHeight (50),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (13),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
Max = 100,
|
SleepTime = 1000,
|
ThumbRadius = 9,
|
//IsCanClick=false
|
};
|
frameLayout.AddChidren (horizontalSeekBarVol);
|
horizontalSeekBarVol.ProgressChanged += (sender, e) => {
|
currentSonosMusic.eventsend (currentSonosMusic, 28, horizontalSeekBarVol.Progress);
|
currentSonosMusic.sonosPlayStatus.vol = horizontalSeekBarVol.Progress.ToString ();
|
};
|
#endregion
|
|
Volume.VolumeChange = (volume) => {
|
//if (Application.DeviceType == Device.Ios && A31MusicModel.Current.A31PlayStatus.Source == "BLUETOOTH") {
|
// return;
|
//}
|
horizontalSeekBarVol.Progress = volume;
|
currentSonosMusic.sonosPlayStatus.vol = horizontalSeekBarVol.Progress.ToString ();
|
currentSonosMusic.eventsend (currentSonosMusic, 28, horizontalSeekBarVol.Progress);
|
|
};
|
|
//加音量
|
addbtnMusicvo.MouseUpEventHandler += (sen, e) => {
|
addbtnMusicvo.IsSelected = false;
|
var voladd = horizontalSeekBarVol.Progress + 1;
|
if (voladd > 100) {
|
voladd = 100;
|
}
|
currentSonosMusic.eventsend (currentSonosMusic, 28, voladd);
|
currentSonosMusic.sonosPlayStatus.vol = voladd.ToString ();
|
horizontalSeekBarVol.Progress = voladd;
|
};
|
addbtnMusicvo.MouseDownEventHandler += (sen, e) => {
|
addbtnMusicvo.IsSelected = true;
|
};
|
|
//减音量
|
redbtnMusicvol.MouseUpEventHandler += (sen, e) => {
|
redbtnMusicvol.IsSelected = false;
|
var volred = horizontalSeekBarVol.Progress - 1;
|
if (volred < 0) {
|
volred = 0;
|
}
|
|
currentSonosMusic.eventsend (currentSonosMusic, 28, volred);
|
currentSonosMusic.sonosPlayStatus.vol = volred.ToString ();
|
horizontalSeekBarVol.Progress = volred;
|
};
|
redbtnMusicvol.MouseDownEventHandler += (sen, e) => {
|
redbtnMusicvol.IsSelected = true;
|
};
|
}
|
|
|
|
/// <summary>
|
/// 模式切换
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Mode_MouseDownEventHandler (object sender, MouseEventArgs e)
|
{
|
Button button = (Button)sender;
|
switch (currentSonosMusic.sonosPlayStatus.playModes) {
|
|
|
//(2:单曲循环,3:顺序播放、4:全部、5:随机播放)
|
case 5:
|
currentSonosMusic.sonosPlayStatus.playModes = 2;
|
button.UnSelectedImagePath = "MusicIcon/playModeDDdanquplay.png";
|
button.IsSelected = false;
|
break;
|
|
case 2:
|
currentSonosMusic.sonosPlayStatus.playModes = 3;
|
button.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
button.IsSelected = false;
|
break;
|
|
case 3:
|
currentSonosMusic.sonosPlayStatus.playModes = 4;
|
button.UnSelectedImagePath ="MusicIcon/playModeshunxuplay.png";
|
button.IsSelected = false;
|
break;
|
case 4:
|
currentSonosMusic.sonosPlayStatus.playModes = 5;
|
button.UnSelectedImagePath = "MusicIcon/playModesuijiplay.png";
|
button.IsSelected = false;
|
break;
|
|
default:
|
currentSonosMusic.sonosPlayStatus.playModes = 3;
|
button.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
button.IsSelected = false;
|
break;
|
|
}
|
currentSonosMusic.eventsend (currentSonosMusic, 5, currentSonosMusic.sonosPlayStatus.playModes);
|
}
|
|
/// <summary>
|
/// 读取音乐状态
|
/// </summary>
|
void readStatus ()
|
{
|
System.Threading.Tasks.Task.Run (() => {
|
System.DateTime dateTime = System.DateTime.Now.AddSeconds (-5);
|
|
while (Parent != null) {
|
//等待1秒,更新界面
|
System.Threading.Thread.Sleep (1000 * 1);
|
|
Application.RunOnMainThread (() => {
|
#region
|
try {
|
string patn = "SonosMusicImage_";
|
if (Shared.IO.FileUtils.Exists (patn+ currentSonosMusic.sonosPlayStatus.songName)) {
|
portrait.ImagePath = patn+ currentSonosMusic.sonosPlayStatus.songName;
|
} else {
|
portrait.ImagePath = "MusicIcon/PlayPortrait.png";
|
System.Threading.Tasks.Task.Run (() => {
|
var filePath = SonosMusic.SonosMusicImage (currentSonosMusic.sonosPlayStatus.imageUrl, currentSonosMusic.sonosPlayStatus.songName);
|
if (filePath != null) {
|
Application.RunOnMainThread (() => {
|
portrait.ImagePath = filePath;
|
});
|
}
|
});
|
}
|
|
|
//总共有多少秒
|
int totalSecond = currentSonosMusic.sonosPlayStatus.durationMillis / 1000;
|
//分钟
|
int totalMusicMinute = totalSecond / 60;
|
//秒钟
|
int totalMusicSecond = totalSecond % 60;
|
|
string totalTime = (totalMusicMinute.ToString ().Length < 2 ? "0" + totalMusicMinute.ToString () : totalMusicMinute.ToString ()) + ":" + (totalMusicSecond.ToString ().Length < 2 ? "0" + totalMusicSecond.ToString () : totalMusicSecond.ToString ());
|
btnTotalMusicTime.Text = totalTime;
|
|
title.Text = currentSonosMusic.sonosPlayStatus.songName;
|
musicartist.Text = currentSonosMusic.sonosPlayStatus.artist;
|
horizontalSeekBarVol.Progress = int.Parse (currentSonosMusic.sonosPlayStatus.vol);
|
//更新播放器音量给系统音量
|
Volume.MusicVolume = horizontalSeekBarVol.Progress;
|
switch (currentSonosMusic.sonosPlayStatus.playModes) {
|
#region
|
case 2:
|
mode.UnSelectedImagePath = "MusicIcon/playModeDDdanquplay.png";
|
break;
|
case 3:
|
mode.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
break;
|
case 4:
|
mode.UnSelectedImagePath ="MusicIcon/playModeshunxuplay.png";
|
break;
|
case 5:
|
mode.UnSelectedImagePath = "MusicIcon/playModesuijiplay.png";
|
break;
|
|
default:
|
mode.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
break;
|
#endregion
|
}
|
setName.Text = currentSonosMusic.name;
|
if (currentSonosMusic.sonosPlayStatus.mute) {
|
btnMute.IsSelected = true;
|
} else {
|
btnMute.IsSelected = false;
|
}
|
//btnMute.IsSelected = currentSonosMusic.sonosPlayStatus.vol == "0" ? true : false;
|
if (currentSonosMusic.sonosPlayStatus.playbackState == 1) {
|
btnPlay.IsSelected = true;
|
//如果在播放,时间就不断变化
|
//当前播放音乐时间
|
int playSecond = currentSonosMusic.sonosPlayStatus.positionMillis / 1000 + (int)(DateTime.Now - currentSonosMusic.sonosPlayStatus.DateTime).TotalSeconds;
|
//分钟
|
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 ());
|
//如果在播放,时间就不断变化
|
btnMusicplayTime.Text = playTime;
|
if (totalSecond == 0) {
|
SeekBarVol.Progress = 0;
|
} else {
|
SeekBarVol.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
|
}
|
} else {
|
//停止状态
|
btnPlay.IsSelected = false;
|
btnMusicplayTime.Text = "00:00";
|
btnTotalMusicTime.Text = "00:00";
|
}
|
showSourcePage ();
|
} catch {
|
}
|
#endregion
|
|
|
});
|
}
|
});
|
}
|
|
|
|
|
|
|
}
|
}
|