UI: Give Mesen focus when drag and dropping rom files

This commit is contained in:
Souryo 2016-02-11 19:57:21 -05:00
parent cbe8db4524
commit ff11250a73
2 changed files with 6 additions and 0 deletions

View file

@ -7,6 +7,7 @@ using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Automation;
using System.Windows.Forms;
using System.Xml;
using Mesen.GUI.Config;
@ -971,6 +972,10 @@ namespace Mesen.GUI.Forms
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if(File.Exists(files[0])) {
LoadFile(files[0]);
AutomationElement element = AutomationElement.FromHandle(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
if(element != null) {
element.SetFocus();
}
}
}

View file

@ -159,6 +159,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationClient" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config\PreferenceInfo.cs" />