UI: Give Mesen focus when drag and dropping rom files
This commit is contained in:
parent
cbe8db4524
commit
ff11250a73
2 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,7 @@ using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Automation;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Mesen.GUI.Config;
|
using Mesen.GUI.Config;
|
||||||
|
@ -971,6 +972,10 @@ namespace Mesen.GUI.Forms
|
||||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
if(File.Exists(files[0])) {
|
if(File.Exists(files[0])) {
|
||||||
LoadFile(files[0]);
|
LoadFile(files[0]);
|
||||||
|
AutomationElement element = AutomationElement.FromHandle(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);
|
||||||
|
if(element != null) {
|
||||||
|
element.SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="UIAutomationClient" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Config\PreferenceInfo.cs" />
|
<Compile Include="Config\PreferenceInfo.cs" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue