/// <summary> /// Initializes the cdg library /// </summary> /// <param name="playlistItem"></param> private void InitializeCdgLibrary(PlaylistItem playlistItem) { IntPtr applicationHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; IntPtr parentWindowHandle = new WindowInteropHelper(_videoPlayerWindow).Handle; string mp3FilePath = playlistItem.Song.FilePath; string cdgFilePath = playlistItem.Song.CdgFilePath; if (playlistItem.Song.Extension.Equals("zip")) { _zipFileHelper = new ZipFileHelper(); Song tmpUnzippedSong = _zipFileHelper.ExtractFileTemporarily(mp3FilePath); mp3FilePath = tmpUnzippedSong.FilePath; cdgFilePath = tmpUnzippedSong.CdgFilePath; } _cdgLibDllHandle = CdgLibraryWrapper.CDGPlayerOpenExt(applicationHandle, cdgFilePath, parentWindowHandle, 0); _videoPlayerWindow.VideoPlayer.Source = new Uri(mp3FilePath); _cdgWindowHeight = _videoPlayerWindow.Height; _cdgWindowWidth = _videoPlayerWindow.Width; CdgLibraryWrapper.CDGPlayerHeightSet(_cdgLibDllHandle, (int)_cdgWindowHeight); CdgLibraryWrapper.CDGPlayerWidthSet(_cdgLibDllHandle, (int)_cdgWindowWidth); }
/// <summary> /// When the cdg player window is resized and the /// </summary> /// <param name="sender"></param> /// <param name="sizeChangedEventArgs"></param> private void CDGPlayerWindowOnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs) { _cdgWindowHeight = ((Window)sender).Height; _cdgWindowWidth = ((Window)sender).Width; if (IsCdgLibraryInitialized()) { if (sizeChangedEventArgs.HeightChanged) { CdgLibraryWrapper.CDGPlayerHeightSet(_cdgLibDllHandle, (int)_cdgWindowHeight); } else { CdgLibraryWrapper.CDGPlayerWidthSet(_cdgLibDllHandle, (int)_cdgWindowWidth); } } }