Trimmed WndProc method

This commit is contained in:
Travis Nickles 2018-07-16 17:29:05 -05:00
parent a7b5b2ff35
commit a3943728e3

View File

@ -991,15 +991,16 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
private bool inHotPlug = false;
private int hotplugCounter = 0;
private object hotplugCounterLock = new object();
private const int DBT_DEVNODES_CHANGED = 0x0007;
protected override void WndProc(ref Message m)
{
try
if (m.Msg == ScpDevice.WM_DEVICECHANGE)
{
if (m.Msg == ScpDevice.WM_DEVICECHANGE)
if (runHotPlug)
{
if (runHotPlug)
Int32 Type = m.WParam.ToInt32();
if (Type == DBT_DEVNODES_CHANGED)
{
Int32 Type = m.WParam.ToInt32();
lock (hotplugCounterLock)
{
hotplugCounter++;
@ -1009,19 +1010,18 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
if (!inHotPlug)
{
inHotPlug = true;
TaskRunner.Run(() => { Thread.Sleep(1500); InnerHotplug2(uiContext); });
TaskRunner.Run(() => { Thread.Sleep(1500); InnerHotplug2(uiContext); });
}
}
}
}
catch { }
if (m.Msg == WM_QUERYENDSESSION)
systemShutdown = true;
// If this is WM_QUERYENDSESSION, the closing event should be
// raised in the base WndProc.
try { base.WndProc(ref m); }
catch { }
base.WndProc(ref m);
}
private void InnerHotplug2(SynchronizationContext uiContext)