mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-23 03:23:03 +00:00
fixed crash with sd setup
This commit is contained in:
parent
1f0d9ce671
commit
045b5ac345
1 changed files with 22 additions and 3 deletions
|
@ -73,16 +73,34 @@ namespace UWUVCI_AIO_WPF.UI.Windows
|
|||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
|
||||
watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||
watcher.Query = query;
|
||||
watcher.Options.Timeout = new TimeSpan(0, 0, 5);
|
||||
watcher.Start();
|
||||
watcher.WaitForNextEvent();
|
||||
try
|
||||
{
|
||||
watcher.WaitForNextEvent();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private void checkfornewoutput()
|
||||
{
|
||||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 3");
|
||||
watcher2.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||
watcher2.Query = query;
|
||||
watcher2.Options.Timeout = new TimeSpan(0, 0, 5);
|
||||
watcher2.Start();
|
||||
watcher2.WaitForNextEvent();
|
||||
try
|
||||
{
|
||||
watcher2.WaitForNextEvent();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
|
||||
|
@ -157,7 +175,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows
|
|||
|
||||
watcher.Stop();
|
||||
watcher2.Stop();
|
||||
|
||||
watcher.Dispose();
|
||||
watcher2.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
private void close_MouseLeave(object sender, MouseEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue