Added initial notify icon shortcut

Added initial notify icon shortcut menu. Have yet
to hook it up to programme start so that it gets
populated.

Also tried to do some tiy up of the Main procedure
of the Program.cs.
This commit is contained in:
Terry MacDonald 2020-10-26 12:39:14 +13:00
parent eaf14afa0c
commit ed0ccede4c
4 changed files with 212 additions and 31 deletions

View File

@ -249,7 +249,6 @@
<None Include="Resources\Epic.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="HeliosPlus.ico" />
<Content Include="HeliosPlus2.ico" />
<Content Include="Resources\redarrows.png" />
</ItemGroup>

View File

@ -40,10 +40,8 @@ namespace HeliosPlus {
public static string AppHeliosPlusIconFilename = Path.Combine(AppIconPath, @"HeliosPlus.ico");
public static string AppOriginIconFilename = Path.Combine(AppIconPath, @"Origin.ico");
public static string AppSteamIconFilename = Path.Combine(AppIconPath, @"Steam.ico");
public static string AppUplayIconFilename = Path.Combine(AppIconPath, @"Steam.ico");
public static string AppUplayIconFilename = Path.Combine(AppIconPath, @"Uplay.ico");
public static string AppEpicIconFilename = Path.Combine(AppIconPath, @"Epic.ico");
//internal static string ShortcutIconCachePath;
/// <summary>
@ -61,7 +59,7 @@ namespace HeliosPlus {
}
Console.WriteLine("=");
Console.WriteLine($"Copyright © Terry MacDonald 2020-{DateTime.Today.Year}");
Console.WriteLine(@"Based on Helios Display Management - Copyright © Soroush Falahati 2017-2020");
Console.WriteLine(@"Derived from Helios Display Management - Copyright © Soroush Falahati 2017-2020");
//Application.SetHighDpiMode(HighDpiMode.SystemAware);
@ -120,20 +118,19 @@ namespace HeliosPlus {
}
catch (CommandParsingException ex)
{
//Console.WriteLine($"Program/Main commandParsingException: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
// You'll always want to catch this exception, otherwise it will generate a messy and confusing error for the end user.
// the message will usually be something like:
// "Unrecognized command or argument '<invalid-command>'"
//Console.WriteLine(ex.Message);
Console.WriteLine("Didn't recognise the supplied commandline options: {0}", ex.Message);
}
catch (Exception ex)
{
Console.WriteLine($"Program/Main exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
Console.WriteLine("Unable to execute application: {0}", ex.Message);
//Console.WriteLine($"Program/Main commandParsingException: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
// You'll always want to catch this exception, otherwise it will generate a messy and confusing error for the end user.
// the message will usually be something like:
// "Unrecognized command or argument '<invalid-command>'"
Console.WriteLine($"Program/Main exception: Unable to execute application - {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
}
// Exit with a 0 Errorlevel to indicate everything worked fine!
return 0;
//return app.Execute(args);
}
private static void StartUpNormally()
@ -227,9 +224,7 @@ namespace HeliosPlus {
catch (Exception ex)
{
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
// TODO
}
IPCService.GetInstance().Status = InstanceStatus.User;
Application.Run(new UIForms.MainForm());

View File

@ -37,13 +37,23 @@
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.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.mainNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.mainContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.changeDisplayProfileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.profilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.runShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openApplicationWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_display_profile)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pb_game_shortcut)).BeginInit();
this.mainContextMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@ -117,9 +127,65 @@
this.pb_game_shortcut.TabStop = false;
this.pb_game_shortcut.Click += new System.EventHandler(this.pb_game_shortcut_Click);
//
// notifyIcon
// mainNotifyIcon
//
resources.ApplyResources(this.notifyIcon, "notifyIcon");
resources.ApplyResources(this.mainNotifyIcon, "mainNotifyIcon");
this.mainNotifyIcon.ContextMenuStrip = this.mainContextMenuStrip;
//
// mainContextMenuStrip
//
this.mainContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1,
this.toolStripSeparator1,
this.openApplicationWindowToolStripMenuItem,
this.changeDisplayProfileToolStripMenuItem,
this.runShortcutToolStripMenuItem});
this.mainContextMenuStrip.Name = "mainContextMenuStrip";
resources.ApplyResources(this.mainContextMenuStrip, "mainContextMenuStrip");
//
// toolStripMenuItem1
//
resources.ApplyResources(this.toolStripMenuItem1, "toolStripMenuItem1");
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
//
// changeDisplayProfileToolStripMenuItem
//
this.changeDisplayProfileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.profilesToolStripMenuItem,
this.toolStripSeparator2,
this.toolStripMenuItem2});
this.changeDisplayProfileToolStripMenuItem.Name = "changeDisplayProfileToolStripMenuItem";
resources.ApplyResources(this.changeDisplayProfileToolStripMenuItem, "changeDisplayProfileToolStripMenuItem");
//
// profilesToolStripMenuItem
//
this.profilesToolStripMenuItem.Name = "profilesToolStripMenuItem";
resources.ApplyResources(this.profilesToolStripMenuItem, "profilesToolStripMenuItem");
//
// runShortcutToolStripMenuItem
//
this.runShortcutToolStripMenuItem.Name = "runShortcutToolStripMenuItem";
resources.ApplyResources(this.runShortcutToolStripMenuItem, "runShortcutToolStripMenuItem");
//
// openApplicationWindowToolStripMenuItem
//
resources.ApplyResources(this.openApplicationWindowToolStripMenuItem, "openApplicationWindowToolStripMenuItem");
this.openApplicationWindowToolStripMenuItem.Name = "openApplicationWindowToolStripMenuItem";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
resources.ApplyResources(this.toolStripMenuItem2, "toolStripMenuItem2");
//
// MainForm
//
@ -138,6 +204,7 @@
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pb_display_profile)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pb_game_shortcut)).EndInit();
this.mainContextMenuStrip.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -151,6 +218,15 @@
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 notifyIcon;
private System.Windows.Forms.NotifyIcon mainNotifyIcon;
private System.Windows.Forms.ContextMenuStrip mainContextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem changeDisplayProfileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem profilesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem runShortcutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openApplicationWindowToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}

View File

@ -10768,7 +10768,7 @@
<value>Microsoft Sans Serif, 21.75pt</value>
</data>
<data name="btn_setup_game_shortcuts.Location" type="System.Drawing.Point, System.Drawing">
<value>212, 188</value>
<value>212, 194</value>
</data>
<data name="btn_setup_game_shortcuts.Size" type="System.Drawing.Size, System.Drawing">
<value>360, 50</value>
@ -10798,7 +10798,7 @@
<value>Flat</value>
</data>
<data name="btn_exit.Location" type="System.Drawing.Point, System.Drawing">
<value>698, 353</value>
<value>698, 354</value>
</data>
<data name="btn_exit.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@ -63140,18 +63140,81 @@
<value>$this</value>
</data>
<data name="&gt;&gt;splitContainer1.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="mainNotifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="notifyIcon.BalloonTipText" xml:space="preserve">
<data name="mainNotifyIcon.BalloonTipText" xml:space="preserve">
<value>Use this application to automatically change your display settings when you run a game.</value>
</data>
<data name="notifyIcon.BalloonTipTitle" xml:space="preserve">
<data name="mainNotifyIcon.BalloonTipTitle" xml:space="preserve">
<value>HeliosPlus</value>
</data>
<data name="notifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<metadata name="mainContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>152, 17</value>
</metadata>
<data name="toolStripMenuItem1.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="toolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>218, 22</value>
</data>
<data name="toolStripMenuItem1.Text" xml:space="preserve">
<value>HeliosPlus</value>
</data>
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 6</value>
</data>
<data name="openApplicationWindowToolStripMenuItem.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt, style=Bold</value>
</data>
<data name="openApplicationWindowToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>218, 22</value>
</data>
<data name="openApplicationWindowToolStripMenuItem.Text" xml:space="preserve">
<value>Open Application Window</value>
</data>
<data name="profilesToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="profilesToolStripMenuItem.Text" xml:space="preserve">
<value>Display Profiles</value>
</data>
<data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>177, 6</value>
</data>
<data name="toolStripMenuItem2.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="toolStripMenuItem2.Text" xml:space="preserve">
<value>DIsplay Profile 1</value>
</data>
<data name="changeDisplayProfileToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>218, 22</value>
</data>
<data name="changeDisplayProfileToolStripMenuItem.Text" xml:space="preserve">
<value>Change Display Profile To</value>
</data>
<data name="runShortcutToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>218, 22</value>
</data>
<data name="runShortcutToolStripMenuItem.Text" xml:space="preserve">
<value>Run Shortcut</value>
</data>
<data name="mainContextMenuStrip.Size" type="System.Drawing.Size, System.Drawing">
<value>219, 120</value>
</data>
<data name="mainContextMenuStrip.Text" xml:space="preserve">
<value>Text</value>
</data>
<data name="&gt;&gt;mainContextMenuStrip.Name" xml:space="preserve">
<value>mainContextMenuStrip</value>
</data>
<data name="&gt;&gt;mainContextMenuStrip.Type" xml:space="preserve">
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="mainNotifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAkAEBAAAAEAIABoBAAAlgAAABgYAAABACAAiAkAAP4EAAAgIAAAAQAgAKgQAACGDgAAMDAAAAEA
IACoJQAALh8AAEBAAAABACAAKEIAANZEAABgYAAAAQAgAKiUAAD+hgAAgIAAAAEAIAAoCAEAphsBAMDA
@ -70962,10 +71025,10 @@
rjGJe6619efaHz2S/5D4v/OFla+gZqVXAAAAAElFTkSuQmCC
</value>
</data>
<data name="notifyIcon.Text" xml:space="preserve">
<data name="mainNotifyIcon.Text" xml:space="preserve">
<value>HeliosPlus</value>
</data>
<data name="notifyIcon.Visible" type="System.Boolean, mscorlib">
<data name="mainNotifyIcon.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -78803,12 +78866,60 @@
<data name="$this.Text" xml:space="preserve">
<value>HeliosPlus</value>
</data>
<data name="&gt;&gt;notifyIcon.Name" xml:space="preserve">
<value>notifyIcon</value>
<data name="&gt;&gt;mainNotifyIcon.Name" xml:space="preserve">
<value>mainNotifyIcon</value>
</data>
<data name="&gt;&gt;notifyIcon.Type" xml:space="preserve">
<data name="&gt;&gt;mainNotifyIcon.Type" xml:space="preserve">
<value>System.Windows.Forms.NotifyIcon, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripMenuItem1.Name" xml:space="preserve">
<value>toolStripMenuItem1</value>
</data>
<data name="&gt;&gt;toolStripMenuItem1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator1.Name" xml:space="preserve">
<value>toolStripSeparator1</value>
</data>
<data name="&gt;&gt;toolStripSeparator1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;changeDisplayProfileToolStripMenuItem.Name" xml:space="preserve">
<value>changeDisplayProfileToolStripMenuItem</value>
</data>
<data name="&gt;&gt;changeDisplayProfileToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;profilesToolStripMenuItem.Name" xml:space="preserve">
<value>profilesToolStripMenuItem</value>
</data>
<data name="&gt;&gt;profilesToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;runShortcutToolStripMenuItem.Name" xml:space="preserve">
<value>runShortcutToolStripMenuItem</value>
</data>
<data name="&gt;&gt;runShortcutToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;openApplicationWindowToolStripMenuItem.Name" xml:space="preserve">
<value>openApplicationWindowToolStripMenuItem</value>
</data>
<data name="&gt;&gt;openApplicationWindowToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator2.Name" xml:space="preserve">
<value>toolStripSeparator2</value>
</data>
<data name="&gt;&gt;toolStripSeparator2.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripMenuItem2.Name" xml:space="preserve">
<value>toolStripMenuItem2</value>
</data>
<data name="&gt;&gt;toolStripMenuItem2.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainForm</value>
</data>