예제 #1
0
 /// <summary>
 /// Disables custom window preview on this form, meaning that
 /// the DWM will not send messages when a live thumbnail preview
 /// or a live peek will be necessary, but instead rely on its
 /// default rendering.
 /// </summary>
 /// <param name="form">The form.</param>
 public static void DisableCustomWindowPreview(this Form form)
 {
     Windows7Taskbar.DisableCustomWindowPreview(form.Handle);
 }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            playback = mcRef.GetPlayback();
            //customWindow = Windows7.DesktopIntegration.CustomWindowsManager.CreateWindowsManager((IntPtr)mcRef.GetWindowHandle(), IntPtr.Zero);
            //IMJFileAutomation nowPlayingFile;
            //nowPlayingFile = mcRef.GetCurPlaylist().GetFile(mcRef.GetCurPlaylist().Position);

            int i = 0;

            string prevFile    = "";
            string currentFile = "";

            while (playback.State != MJPlaybackStates.PLAYSTATE_STOPPED)
            {
                nowPlayingFile = mcRef.GetCurPlaylist().GetFile(mcRef.GetCurPlaylist().Position);

                setWindowsPeak();
                if (enableCoverArt.Checked)
                {
                    Windows7Taskbar.EnableCustomWindowPreview((IntPtr)mcRef.GetWindowHandle());
                    currentFile = nowPlayingFile.GetImageFile(MJImageFileFlags.IMAGEFILE_THUMBNAIL_MEDIUM);
                    if (!string.IsNullOrEmpty(currentFile))
                    {
                        if (currentFile != prevFile)
                        {
                            setPreview(currentFile);
                        }
                    }
                    else
                    {
                        Windows7Taskbar.DisableCustomWindowPreview((IntPtr)mcRef.GetWindowHandle());
                    }

                    prevFile = currentFile;
                }
                else
                {
                    Windows7Taskbar.DisableCustomWindowPreview((IntPtr)mcRef.GetWindowHandle());
                }


                createThumbnail(getDisplayWindowHandle());
                if (trackProgress.Checked)
                {
                    if (playback.State == MJPlaybackStates.PLAYSTATE_PLAYING)
                    {
                        windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);
                        addUserInfoText("Duration: " + playback.Duration);
                        if (nowPlayingFile.Duration <= 0)
                        {
                            windowsTaskbar.SetProgressState(TaskbarProgressBarState.Indeterminate);
                        }
                        else
                        {
                            if (playback.Position >= 0)
                            {
                                windowsTaskbar.SetProgressValue(playback.Position, nowPlayingFile.Duration);
                            }
                        }
                    }
                    else if (playback.State == MJPlaybackStates.PLAYSTATE_PAUSED)
                    {
                        windowsTaskbar.SetProgressState(TaskbarProgressBarState.Paused);
                    }
                }

                else if (playlistProgress.Checked)
                {
                    windowsTaskbar.SetProgressState(playback.State != MJPlaybackStates.PLAYSTATE_PAUSED ? TaskbarProgressBarState.Normal : TaskbarProgressBarState.Paused);
                    windowsTaskbar.SetProgressValue(mcRef.GetCurPlaylist().Position, mcRef.GetCurPlaylist().GetNumberFiles());
                }

                else
                {
                    windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);
                }
                setWindowTitle();
                System.Threading.Thread.Sleep(500);
                GC.Collect();
                i++;
            }
            //Windows7Taskbar.DisableCustomWindowPreview((IntPtr)mcRef.GetWindowHandle());
            windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);
            return;
        }
예제 #3
0
 /// <summary>
 /// Disables custom window preview on this Window, meaning that
 /// the DWM will not send messages when a live thumbnail preview
 /// or a live peek will be necessary, but instead rely on its
 /// default rendering.
 /// </summary>
 /// <param name="form">The form.</param>
 public static void DisableCustomWindowPreview(this Window form)
 {
     Windows7Taskbar.DisableCustomWindowPreview(GetWindowHandle(form));
 }
 public void DisablePreview()
 {
     Windows7Taskbar.DisableCustomWindowPreview(WindowToTellDwmAbout);
 }