/// <summary> /// 初始化播放器 /// </summary> private void InitBassEngine() { //歌曲播放完毕 //SpectrumAnalyzer.RegisterSoundPlayer(BassEngine.Instance); BassEngine.ExplicitInitialize(null); BassEngine.Instance.TrackEnded += delegate { if (musicWindow != null) { musicWindow.CloseThis(); musicWindow = null; } }; //音乐加载成功 BassEngine.Instance.OpenSucceeded += delegate { Debug.WriteLine(" 音乐加载成功"); BassEngine.Instance.Volume = 1; BassEngine.Instance.Play(); }; //打开音乐失败 BassEngine.Instance.OpenFailed += delegate { if (musicWindow != null) { musicWindow.CloseThis(); musicWindow = null; } }; //绑定音量设置 }
void ListenerLeapTapScreenReady(object sender) { if (detialWindow != null || musicWindow != null) { Action action2 = null; if (detialWindow != null) { action2 = () => detialWindow.CloseThis(); } else { action2 = () => musicWindow.CloseThis(); } Dispatcher.BeginInvoke(DispatcherPriority.Send, action2).Completed += (a, b) => { detialWindow = null; musicWindow = null; }; } else { Action action = () => OpenSubWindow(); Dispatcher.BeginInvoke(DispatcherPriority.Send, action); } }
/// <summary> /// 打开图片展示或者音乐播放窗口 /// </summary> private void OpenSubWindow() { string path = CheckIfMusicPath(currentIndex); if (path != "") { ID3Info id3Info = new ID3Info(path, true); id3Info.Load(); BassEngine.Instance.OpenFile(path); musicWindow = new MusicWindow(images[currentIndex], id3Info); musicWindow.Show(); } else { detialWindow = new DetialWindow(images[currentIndex]); detialWindow.Show(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e">Gesture event arguments.</param> private void OnGestureRecognized(object sender, GestureEventArgs e) { switch (e.GestureName) { case "Menu": if (detialWindow == null && musicWindow == null) { HighLightStickMan(); this.CloseThis(); } break; case "JoinedHands": if (musicWindow != null && detialWindow == null) { HighLightStickMan(); musicWindow.ChangeStatue(); } break; case "ZoomIn": //Gesture = "Zoom In"; if (detialWindow == null && musicWindow == null) { HighLightStickMan(); this.Close(); } break; case "ZoomOut": //Gesture = "Zoom Out"; break; case "Pull": case "PullLeft": if (detialWindow == null && musicWindow == null) { HighLightStickMan(); OpenSubWindow(); } break; case "Push": case "PushLeft": if (detialWindow != null || musicWindow != null) { HighLightStickMan(); if (detialWindow != null) { detialWindow.CloseThis(); detialWindow = null; } else { musicWindow.CloseThis(); musicWindow = null; } } break; default: break; } //_clearTimer.Start(); }
public static MusicWindow GetInstance(FileInfo imgSrc) { if (Instace != null) Instace.Close(); Instace = new MusicWindow(imgSrc); return Instace; }