If your application is associated with a specific file extension, then you get the last part for free! The taskbar also lists files opened by your application in the Recent category!
To check if your file extension is associated with your application, open your registry editor and navigate to HKEY_CLASSES_ROOT
and search for your extension!
Here is a code snippet to check:
RegistryKey openWithKey = Registry.ClassesRoot.OpenSubKey
(Path.Combine(".wpost", "OpenWithProgIds"));
string value = openWithKey.GetValue(progId, null) as string;
if (value == null)
{
}
else
{
}
Registering a file extension is extremely easy using the RegistrationHelper
:
string executablePath = Assembly.GetEntryAssembly().Location;
RegistrationHelper.RegisterFileAssociations(
"LiveWriter",
false,
"LiveWriter",
executablePath + " /doc %1",
".wpost");
To manually report file usage to shell, call AddToRecent
:
jumpList.AddToRecent(fileName);
Note: The dialog box automatically reports usage to shell, but it's still recommended that the user explicitly call AddToRecent
. Shell will automatically handle duplicate additions.
And that’s it…
CodeProject