From f927548ff52e38d35ca18d70aed7b399aed65bd8 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 7 Oct 2012 16:33:43 +0000 Subject: WinGui: Remove the Windows API Code Pack Library, it's no longer needed with .NET 4 since we can use .NETs built in taskbar progress states. Removed some other libraries we no longer use. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5005 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Utilities/Win7.cs | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices/Utilities') diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs index 5c5b78049..f1d78be6c 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs @@ -9,41 +9,50 @@ namespace HandBrake.ApplicationServices.Utilities { - using Microsoft.WindowsAPICodePack.Taskbar; + using System.Windows.Shell; + /// - /// A class implimenting Windows 7 Specific features + /// A class implementing Windows 7 Specific features /// public class Win7 { /// /// The Windows Taskbar /// - private TaskbarManager windowsTaskbar; + public static TaskbarItemInfo WindowsTaskbar; /// /// Initializes a new instance of the class. /// public Win7() { - if (this.IsWindowsSeven) - { - this.windowsTaskbar = TaskbarManager.Instance; - this.windowsTaskbar.ApplicationId = "HandBrake"; - } + if (WindowsTaskbar == null) + WindowsTaskbar = new TaskbarItemInfo(); } /// - /// Gets a value indicating whether this is Windows Seven. + /// Gets a value indicating whether is windows seven. /// public bool IsWindowsSeven { get { - return TaskbarManager.IsPlatformSupported; + return true; } } + /// + /// The get task bar. + /// + /// + /// The . + /// + public TaskbarItemInfo GetTaskBar() + { + return WindowsTaskbar; + } + /// /// Set the Task Bar Percentage. /// @@ -52,13 +61,13 @@ namespace HandBrake.ApplicationServices.Utilities /// public void SetTaskBarProgress(int percentage) { - if (!this.IsWindowsSeven) - { - return; - } - - this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal); - this.windowsTaskbar.SetProgressValue(percentage, 100); + // Update the taskbar progress indicator. The normal state shows a green progress bar. + Caliburn.Micro.Execute.OnUIThread( + () => + { + WindowsTaskbar.ProgressState = TaskbarItemProgressState.Normal; + WindowsTaskbar.ProgressValue = (double)percentage / 100; + }); } /// @@ -66,12 +75,7 @@ namespace HandBrake.ApplicationServices.Utilities /// public void SetTaskBarProgressToNoProgress() { - if (!this.IsWindowsSeven) - { - return; - } - - this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress); + Caliburn.Micro.Execute.OnUIThread(() => WindowsTaskbar.ProgressState = TaskbarItemProgressState.None); } } } \ No newline at end of file -- cgit v1.2.3