I guess this might help us someday, if we support other environments...
This commit is contained in:
parent
1821f631fe
commit
c2fa9070a3
|
@ -122,7 +122,6 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\References\OpenTK.dll</HintPath>
|
<HintPath>..\References\OpenTK.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
<Reference Include="SlimDX, Version=4.0.10.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86">
|
<Reference Include="SlimDX, Version=4.0.10.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\References\$(Platform)\SlimDX.dll</HintPath>
|
<HintPath>..\References\$(Platform)\SlimDX.dll</HintPath>
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
|
@ -11,13 +9,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public class JumpLists
|
public class JumpLists
|
||||||
{
|
{
|
||||||
static Application _app;
|
static readonly Assembly PresentationFramework;
|
||||||
|
static Type Application;
|
||||||
|
static Type JumpList;
|
||||||
|
static Type JumpTask;
|
||||||
|
|
||||||
|
static object _app;
|
||||||
static JumpLists()
|
static JumpLists()
|
||||||
{
|
{
|
||||||
_app = new Application();
|
try
|
||||||
var jmp = new JumpList();
|
{
|
||||||
|
PresentationFramework = Assembly.Load("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
|
||||||
|
Application = PresentationFramework.GetType("System.Windows.Application");
|
||||||
|
JumpList = PresentationFramework.GetType("System.Windows.Shell.JumpList");
|
||||||
|
JumpTask = PresentationFramework.GetType("System.Windows.Shell.JumpTask");
|
||||||
|
_app = Activator.CreateInstance(Application);
|
||||||
|
dynamic jmp = Activator.CreateInstance(JumpList);
|
||||||
jmp.ShowRecentCategory = true;
|
jmp.ShowRecentCategory = true;
|
||||||
JumpList.SetJumpList(_app, jmp);
|
JumpList.GetMethod("SetJumpList").Invoke(null, new[] { _app, jmp });
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -31,18 +42,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// title = fullpath.Split('|')[1];
|
// title = fullpath.Split('|')[1];
|
||||||
//else
|
//else
|
||||||
// title = Path.GetFileName(fullpath);
|
// title = Path.GetFileName(fullpath);
|
||||||
|
try
|
||||||
|
{
|
||||||
string exepath = Assembly.GetEntryAssembly().Location;
|
string exepath = Assembly.GetEntryAssembly().Location;
|
||||||
|
|
||||||
var ji = new JumpTask
|
dynamic ji = Activator.CreateInstance(JumpTask);
|
||||||
{
|
|
||||||
ApplicationPath = exepath,
|
ji.ApplicationPath = exepath;
|
||||||
Arguments = '"' + fullpath + '"',
|
ji.Arguments = '"' + fullpath + '"';
|
||||||
Title = title,
|
ji.Title = title;
|
||||||
// for some reason, this doesn't work
|
// for some reason, this doesn't work
|
||||||
WorkingDirectory = Path.GetDirectoryName(exepath)
|
ji.WorkingDirectory = Path.GetDirectoryName(exepath);
|
||||||
};
|
|
||||||
JumpList.AddToRecentCategory(ji);
|
JumpList.GetMethod("AddToRecentCategory", new[] { JumpTask }).Invoke(null, new[] { ji });
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue