summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-06-26 20:09:58 +0000
committersr55 <[email protected]>2010-06-26 20:09:58 +0000
commit66ac30957390dc8568d6bf0064f1d69736bed4d3 (patch)
tree1b26dc2fa48ff3be50b8320e0d798aab9aa005d9 /win
parent6bed16cdfb77cd54141f189d65bcc53adcfca70d (diff)
WinGui:
- Integrated Windows 7 Taskbar support. The taskbar icon now shows the encode progress bar. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3409 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Win7.cs75
-rw-r--r--win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj17
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Encode.cs18
-rw-r--r--win/C#/libraries/Microsoft.WindowsAPICodePack.Shell.dllbin0 -> 486400 bytes
-rw-r--r--win/C#/libraries/Microsoft.WindowsAPICodePack.dllbin0 -> 81920 bytes
5 files changed, 106 insertions, 4 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs b/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs
new file mode 100644
index 000000000..d8f522fe3
--- /dev/null
+++ b/win/C#/HandBrake.ApplicationServices/Functions/Win7.cs
@@ -0,0 +1,75 @@
+/* Win7.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Functions
+{
+ using System;
+
+ using Microsoft.WindowsAPICodePack;
+ using Microsoft.WindowsAPICodePack.Taskbar;
+
+ /// <summary>
+ /// A class implimenting Windows 7 Specific features
+ /// </summary>
+ public class Win7
+ {
+ /// <summary>
+ /// The Windows Taskbar
+ /// </summary>
+ private TaskbarManager windowsTaskbar;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Win7"/> class.
+ /// </summary>
+ public Win7()
+ {
+ if (IsWindowsSeven)
+ {
+ windowsTaskbar = TaskbarManager.Instance;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this is Windows Seven.
+ /// </summary>
+ public bool IsWindowsSeven
+ {
+ get
+ {
+ OperatingSystem os = Environment.OSVersion;
+ return os.Version.Major >= 6 && os.Version.Minor >= 1;
+ }
+ }
+
+ /// <summary>
+ /// Set the Task Bar Percentage.
+ /// </summary>
+ /// <param name="percentage">
+ /// The percentage.
+ /// </param>
+ public void SetTaskBarProgress(int percentage)
+ {
+ if (!IsWindowsSeven)
+ {
+ return;
+ }
+
+ windowsTaskbar.SetProgressValue(percentage, 100);
+ }
+
+ /// <summary>
+ /// Disable Task Bar Progress
+ /// </summary>
+ public void SetTaskBarProgressToNoProgress()
+ {
+ if (!IsWindowsSeven)
+ {
+ return;
+ }
+
+ windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);
+ }
+ }
+} \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 94995c069..148ba78db 100644
--- a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -47,6 +47,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\Growl.CoreLibrary.dll</HintPath>
</Reference>
+ <Reference Include="Microsoft.WindowsAPICodePack, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\libraries\Microsoft.WindowsAPICodePack.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\libraries\Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -73,6 +81,7 @@
<Compile Include="Functions\GrowlCommunicator.cs" />
<Compile Include="Functions\Main.cs" />
<Compile Include="Functions\Win32.cs" />
+ <Compile Include="Functions\Win7.cs" />
<Compile Include="Init.cs" />
<Compile Include="Model\Cropping.cs" />
<Compile Include="Model\Job.cs" />
@@ -114,20 +123,20 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
+ <Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <None Include="Resources\logo64.png" />
+ <EmbeddedResource Include="Resources\logo64.png" />
</ItemGroup>
<ItemGroup>
- <None Include="Resources\ErrorX.png" />
+ <EmbeddedResource Include="Resources\ErrorX.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\AssemblyInfo.cs.tmpl" />
- <None Include="Resources\copy.png" />
+ <EmbeddedResource Include="Resources\copy.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" />
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
index cb6dbee7d..ad5cd8c3d 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
@@ -57,6 +57,11 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private int processID;
+ /// <summary>
+ /// Windows 7 API Pack wrapper
+ /// </summary>
+ private Win7 windowsSeven = new Win7();
+
/* Constructor */
/// <summary>
@@ -276,6 +281,11 @@ namespace HandBrake.ApplicationServices.Services
if (this.EncodeEnded != null)
this.EncodeEnded(this, new EventArgs());
+
+ if (windowsSeven.IsWindowsSeven)
+ {
+ windowsSeven.SetTaskBarProgressToNoProgress();
+ }
}
/// <summary>
@@ -601,6 +611,14 @@ namespace HandBrake.ApplicationServices.Services
if (this.EncodeStatusChanged != null)
this.EncodeStatusChanged(this, eventArgs);
+
+ if (windowsSeven.IsWindowsSeven)
+ {
+ int percent;
+ int.TryParse(Math.Round(percentComplete).ToString(), out percent);
+
+ windowsSeven.SetTaskBarProgress(percent);
+ }
}
}
} \ No newline at end of file
diff --git a/win/C#/libraries/Microsoft.WindowsAPICodePack.Shell.dll b/win/C#/libraries/Microsoft.WindowsAPICodePack.Shell.dll
new file mode 100644
index 000000000..340ddd595
--- /dev/null
+++ b/win/C#/libraries/Microsoft.WindowsAPICodePack.Shell.dll
Binary files differ
diff --git a/win/C#/libraries/Microsoft.WindowsAPICodePack.dll b/win/C#/libraries/Microsoft.WindowsAPICodePack.dll
new file mode 100644
index 000000000..85605b750
--- /dev/null
+++ b/win/C#/libraries/Microsoft.WindowsAPICodePack.dll
Binary files differ