/// <summary> /// 修改播放位置事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlayTimeChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { Slider s = (Slider)sender; if (s.IsFocused && s.IsMouseOver && Mouse.LeftButton == MouseButtonState.Pressed) { PlayControl.SetTime(s.Value); } }
/// <summary> /// 反向初始化插件 /// </summary> public override void DeInit() { PlayControl.Next(); Config.Save(); OutputControl.DeInit(); try { Directory.Delete(Config.SongsCachePath, true); } catch (Exception) { } }
/// <summary> /// 播放或暂停,按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlayControl_PausePlay(object sender, RoutedEventArgs e) { if (PlayControl.isPause) { PlayControl.Play(); } else { PlayControl.Pause(); } }
private static void InitPlayer() { PlayControl.Init(); }
internal static void DGJ_AdminComment(string msg) { if (string.IsNullOrWhiteSpace(msg) || !Config.DanmakuControl) { return; } // 如果弹幕msg没有内容或者不允许弹幕控制 string[] msgs = msg.Split(new string[] { " " }, System.StringSplitOptions.RemoveEmptyEntries); switch (msgs[0]) { case "暫停": case "暂停": if (PlayControl.Pause()) { Log("歌曲已经暂停"); } return; case "播放": if (PlayControl.Play()) { Log("歌曲继续播放"); } return; case "切歌": if (PlayControl.Next()) { Log("已经切掉正在播放的歌曲"); } return; case "刪歌": case "删歌": int num; if (msgs.Length >= 2 && int.TryParse(msgs[1], out num)) { num--; if (num >= 0 && num < Center.Songs.Count) { SongItem item = Center.Songs[num]; Log($"切掉了 {item.User} 点的 {item.SongName}", true); switch (item.Status) { case SongItem.SongStatus.WaitingDownload: Center.RemoveSong(item); return; case SongItem.SongStatus.Downloading: DownloadControl.CancelDownload(); return; default: case SongItem.SongStatus.WaitingPlay: if (item.FilePath != null && item.FilePath != "") { new Thread((object o) => { try { File.Delete(o.ToString()); } catch (Exception) { } }) { IsBackground = true, Name = "切歌后删除文件" } } .Start(item.FilePath); Center.RemoveSong(item); return; case SongItem.SongStatus.Playing: PlayControl.Next(); return; } }
/// <summary> /// 修改音量事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Vol_Changed(object sender, RoutedPropertyChangedEventArgs <double> e) { PlayControl.SetVol((int)((Slider)sender).Value); }
/// <summary> /// 切歌,按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NextSong_Click(object sender, RoutedEventArgs e) { PlayControl.Next(); }
public void MusicVolume(int volume) { PlayControl.SetVol(volume); }
public void MusicNext() { PlayControl.Next(); }
public void MusicPause() { PlayControl.Pause(); }
public void MusicPlay() { PlayControl.Play(); }