Added ChangeProfile startup action

Added the ChangeProfile startup action so that
the Notification Icon in the Notification Tray will
be able to change the display profile easily.
This commit is contained in:
Terry MacDonald 2020-10-22 22:05:15 +13:00
parent 964853ff34
commit 7355b419e8
5 changed files with 6326 additions and 1870 deletions

View File

@ -3,6 +3,7 @@
public enum HeliosStartupAction
{
RunShortcut,
ChangeProfile,
StartUpNormally
}
}

View File

@ -158,6 +158,20 @@ namespace HeliosPlus.Shared
}
}
[JsonIgnore]
public bool IsActive
{
get
{
if (this.Equals(ProfileRepository.CurrentProfile))
return true;
else
return false;
}
}
public string Name { get; set; }
public Topology.Path[] Paths { get; set; } = new Topology.Path[0];

View File

@ -16,16 +16,14 @@ namespace HeliosPlus.ShellExtension
private static ToolStripMenuItem CreateProfileMenu(ProfileItem profile)
{
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, null,
(sender, args) => HeliosPlus.Open(HeliosStartupAction.SwitchProfile, profile))
profileMenu.DropDownItems.Add(new ToolStripMenuItem("Change Profile", null,
(sender, args) => HeliosPlus.Open(HeliosStartupAction.ChangeProfile, profile))
{
Enabled = profile.IsPossible && !profile.IsActive
});
}) ;
profileMenu.DropDownItems.Add(new ToolStripSeparator());
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null,
(sender, args) => HeliosPlus.Open(HeliosStartupAction.EditProfile, profile)));
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
(sender, args) => HeliosPlus.Open(HeliosStartupAction.CreateShortcut, profile)));
profileMenu.DropDownItems.Add(new ToolStripMenuItem("Run Shortcut", null,
(sender, args) => HeliosPlus.Open(HeliosStartupAction.RunShortcut, profile)));
return profileMenu;
}
@ -39,20 +37,19 @@ namespace HeliosPlus.ShellExtension
{
var explorerMenu = new ContextMenuStrip();
if (ProfileItem.LoadAllProfiles().Any())
if (ProfileRepository.AllProfiles.Any())
{
ProfileItem.UpdateCurrentProfile();
var extensionMenu = new ToolStripMenuItem(Language.Display_Profiles,
Properties.Resources.Icon_x16);
Properties.Resources.HeliosPlus.ToBitmap());
foreach (var profile in ProfileItem.LoadAllProfiles())
foreach (var profile in ProfileRepository.AllProfiles)
{
extensionMenu.DropDownItems.Add(CreateProfileMenu(profile));
}
extensionMenu.DropDownItems.Add(new ToolStripSeparator());
extensionMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Manage_Profiles,
Properties.Resources.Icon_x16,
Properties.Resources.HeliosPlus.ToBitmap(),
(sender, args) =>
{
HeliosPlus.Open();
@ -63,7 +60,7 @@ namespace HeliosPlus.ShellExtension
else
{
var extensionMenu = new ToolStripMenuItem(Language.Manage_Profiles,
Properties.Resources.Icon_x16,
Properties.Resources.HeliosPlus.ToBitmap(),
(sender, args) =>
{
HeliosPlus.Open();

View File

@ -37,7 +37,7 @@
this.btn_setup_game_shortcuts = new System.Windows.Forms.Button();
this.btn_exit = new System.Windows.Forms.Button();
this.pb_game_shortcut = new System.Windows.Forms.PictureBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -117,9 +117,9 @@
this.pb_game_shortcut.TabStop = false;
this.pb_game_shortcut.Click += new System.EventHandler(this.pb_game_shortcut_Click);
//
// notifyIcon1
// notifyIcon
//
resources.ApplyResources(this.notifyIcon1, "notifyIcon1");
resources.ApplyResources(this.notifyIcon, "notifyIcon");
//
// MainForm
//
@ -150,6 +150,6 @@
private System.Windows.Forms.Button btn_setup_display_profiles;
private System.Windows.Forms.Button btn_setup_game_shortcuts;
private System.Windows.Forms.Label lbl_version;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.NotifyIcon notifyIcon;
}
}

File diff suppressed because it is too large Load Diff