diff options
author | sr55 <[email protected]> | 2012-10-07 16:33:43 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-10-07 16:33:43 +0000 |
commit | f927548ff52e38d35ca18d70aed7b399aed65bd8 (patch) | |
tree | 3a9accb25f51e062b22cb69c7716aa70316ed2a8 /win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs | |
parent | d5e59956d359b156e086e7ce36a2b6cb358d3c5c (diff) |
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
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Utilities/Win7.cs | 50 |
1 files changed, 27 insertions, 23 deletions
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,42 +9,51 @@ namespace HandBrake.ApplicationServices.Utilities
{
- using Microsoft.WindowsAPICodePack.Taskbar;
+ using System.Windows.Shell;
+
/// <summary>
- /// A class implimenting Windows 7 Specific features
+ /// A class implementing Windows 7 Specific features
/// </summary>
public class Win7
{
/// <summary>
/// The Windows Taskbar
/// </summary>
- private TaskbarManager windowsTaskbar;
+ public static TaskbarItemInfo WindowsTaskbar;
/// <summary>
/// Initializes a new instance of the <see cref="Win7"/> class.
/// </summary>
public Win7()
{
- if (this.IsWindowsSeven)
- {
- this.windowsTaskbar = TaskbarManager.Instance;
- this.windowsTaskbar.ApplicationId = "HandBrake";
- }
+ if (WindowsTaskbar == null)
+ WindowsTaskbar = new TaskbarItemInfo();
}
/// <summary>
- /// Gets a value indicating whether this is Windows Seven.
+ /// Gets a value indicating whether is windows seven.
/// </summary>
public bool IsWindowsSeven
{
get
{
- return TaskbarManager.IsPlatformSupported;
+ return true;
}
}
/// <summary>
+ /// The get task bar.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="TaskbarItemInfo"/>.
+ /// </returns>
+ public TaskbarItemInfo GetTaskBar()
+ {
+ return WindowsTaskbar;
+ }
+
+ /// <summary>
/// Set the Task Bar Percentage.
/// </summary>
/// <param name="percentage">
@@ -52,13 +61,13 @@ namespace HandBrake.ApplicationServices.Utilities /// </param>
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;
+ });
}
/// <summary>
@@ -66,12 +75,7 @@ namespace HandBrake.ApplicationServices.Utilities /// </summary>
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 |