summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-07-20 13:24:52 +0000
committersr55 <[email protected]>2012-07-20 13:24:52 +0000
commit1aadfe267e451acfbc900590a53cd9df87fe50ff (patch)
tree263d496c615073112eda88fcdef773ae01b37742 /win/CS/HandBrakeWPF/Services
parent33c05df81676a99c1323a1a16a85eb50c1a61646 (diff)
WinGui: Array of fixes and changes
- Change Font rendering to "Display" mode to see if folks prefer it. If not it can be reverted back. - Fixes to Queue Edit for the Audio/Subs panel. These should now populate correctly. - Thrown the Drive detector onto a background thread as it seems the windows drive management service can get "stuck" and block the app from starting while it waits. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4867 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/DriveDetectService.cs48
1 files changed, 28 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Services/DriveDetectService.cs b/win/CS/HandBrakeWPF/Services/DriveDetectService.cs
index 7f1b3f9b9..3a4ef5113 100644
--- a/win/CS/HandBrakeWPF/Services/DriveDetectService.cs
+++ b/win/CS/HandBrakeWPF/Services/DriveDetectService.cs
@@ -11,6 +11,7 @@ namespace HandBrakeWPF.Services
{
using System;
using System.Management;
+ using System.Threading;
using HandBrakeWPF.Services.Interfaces;
@@ -37,28 +38,32 @@ namespace HandBrakeWPF.Services
/// </param>
public void StartDetection(Action action)
{
- this.detectionAction = action;
+ ThreadPool.QueueUserWorkItem(
+ delegate
+ {
+ this.detectionAction = action;
- var options = new ConnectionOptions { EnablePrivileges = true };
- var scope = new ManagementScope(@"root\CIMV2", options);
+ var options = new ConnectionOptions { EnablePrivileges = true };
+ var scope = new ManagementScope(@"root\CIMV2", options);
- try
- {
- var query = new WqlEventQuery
- {
- EventClassName = "__InstanceModificationEvent",
- WithinInterval = TimeSpan.FromSeconds(1),
- Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM
- };
+ try
+ {
+ var query = new WqlEventQuery
+ {
+ EventClassName = "__InstanceModificationEvent",
+ WithinInterval = TimeSpan.FromSeconds(1),
+ Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM
+ };
- this.watcher = new ManagementEventWatcher(scope, query);
- this.watcher.EventArrived += this.WatcherEventArrived;
- this.watcher.Start();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
+ this.watcher = new ManagementEventWatcher(scope, query);
+ this.watcher.EventArrived += this.WatcherEventArrived;
+ this.watcher.Start();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
+ }
+ });
}
/// <summary>
@@ -66,7 +71,10 @@ namespace HandBrakeWPF.Services
/// </summary>
public void Close()
{
- this.watcher.Stop();
+ if (watcher != null)
+ {
+ this.watcher.Stop();
+ }
}
/// <summary>