mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Renamed app to HeliosPlus namespace so that the updated changes don't interfere with HeliosDisplayManagement if that is also installed. The fact that I've changed so much of the app means that my changes would be unlikely to be accepted by Soroush, so I'm best to release this work in a similar way to other projects like Notepad++, by keeping the same root name, and adding a plus. I've also changed the Shortcut form to put all the games in a single list to reduce the number of clicks a user has to do in order for them to create a shortcut. I have begun to prepare the form so that it will support multiple game libraries, but now I am at a point that I need to fix the Steam and Uplay game detection mechanisms so that they report the correct information for the lv_games list view.
78 lines
3.1 KiB
C#
78 lines
3.1 KiB
C#
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Windows.Forms;
|
|
using HeliosPlus.Shared;
|
|
using HeliosPlus.ShellExtension.Resources;
|
|
using SharpShell.Attributes;
|
|
using SharpShell.SharpContextMenu;
|
|
|
|
namespace HeliosPlus.ShellExtension
|
|
{
|
|
[ComVisible(true)]
|
|
[COMServerAssociation(AssociationType.Class, @"DesktopBackground")]
|
|
[Guid("2EC0C798-715B-458E-8C86-5D846F67FBA1")]
|
|
internal class HeliosDesktopMenuExtension : SharpContextMenu
|
|
{
|
|
private static ToolStripMenuItem CreateProfileMenu(Profile profile)
|
|
{
|
|
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
|
|
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, null,
|
|
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile))
|
|
{
|
|
Enabled = profile.IsPossible && !profile.IsActive
|
|
});
|
|
profileMenu.DropDownItems.Add(new ToolStripSeparator());
|
|
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null,
|
|
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.EditProfile, profile)));
|
|
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
|
|
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.CreateShortcut, profile)));
|
|
|
|
return profileMenu;
|
|
}
|
|
|
|
protected override bool CanShowMenu()
|
|
{
|
|
return Helios.IsInstalled;
|
|
}
|
|
|
|
protected override ContextMenuStrip CreateMenu()
|
|
{
|
|
var explorerMenu = new ContextMenuStrip();
|
|
|
|
if (Profile.GetAllProfiles().Any())
|
|
{
|
|
Profile.RefreshActiveStatus();
|
|
var extensionMenu = new ToolStripMenuItem(Language.Display_Profiles,
|
|
Properties.Resources.Icon_x16);
|
|
|
|
foreach (var profile in Profile.GetAllProfiles())
|
|
{
|
|
extensionMenu.DropDownItems.Add(CreateProfileMenu(profile));
|
|
}
|
|
|
|
extensionMenu.DropDownItems.Add(new ToolStripSeparator());
|
|
extensionMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Manage_Profiles,
|
|
Properties.Resources.Icon_x16,
|
|
(sender, args) =>
|
|
{
|
|
HeliosDisplayManagement.Open();
|
|
}));
|
|
explorerMenu.Items.Add(extensionMenu);
|
|
explorerMenu.Items.Add(new ToolStripSeparator());
|
|
}
|
|
else
|
|
{
|
|
var extensionMenu = new ToolStripMenuItem(Language.Manage_Profiles,
|
|
Properties.Resources.Icon_x16,
|
|
(sender, args) =>
|
|
{
|
|
HeliosDisplayManagement.Open();
|
|
});
|
|
explorerMenu.Items.Add(extensionMenu);
|
|
explorerMenu.Items.Add(new ToolStripSeparator());
|
|
}
|
|
|
|
return explorerMenu;
|
|
}
|
|
}
|
|
} |