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,17 +73,35 @@ namespace UWUVCI_AIO_WPF.UI.Windows
|
||||||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
|
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
|
||||||
watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||||
watcher.Query = query;
|
watcher.Query = query;
|
||||||
|
watcher.Options.Timeout = new TimeSpan(0, 0, 5);
|
||||||
watcher.Start();
|
watcher.Start();
|
||||||
|
try
|
||||||
|
{
|
||||||
watcher.WaitForNextEvent();
|
watcher.WaitForNextEvent();
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private void checkfornewoutput()
|
private void checkfornewoutput()
|
||||||
{
|
{
|
||||||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 3");
|
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 3");
|
||||||
watcher2.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
watcher2.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||||
watcher2.Query = query;
|
watcher2.Query = query;
|
||||||
|
watcher2.Options.Timeout = new TimeSpan(0, 0, 5);
|
||||||
watcher2.Start();
|
watcher2.Start();
|
||||||
|
try
|
||||||
|
{
|
||||||
watcher2.WaitForNextEvent();
|
watcher2.WaitForNextEvent();
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
|
private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +175,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows
|
||||||
|
|
||||||
watcher.Stop();
|
watcher.Stop();
|
||||||
watcher2.Stop();
|
watcher2.Stop();
|
||||||
|
watcher.Dispose();
|
||||||
|
watcher2.Dispose();
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
private void close_MouseLeave(object sender, MouseEventArgs e)
|
private void close_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue