diff --git a/HeliosDisplayManagement/HeliosDisplayManagement.csproj b/HeliosDisplayManagement/HeliosDisplayManagement.csproj
index 9759f76..ea93075 100644
--- a/HeliosDisplayManagement/HeliosDisplayManagement.csproj
+++ b/HeliosDisplayManagement/HeliosDisplayManagement.csproj
@@ -8,7 +8,7 @@
WinExe
Properties
HeliosDisplayManagement
- HeliosDisplayManagement
+ HeliosPlus
v4.8
512
true
@@ -167,6 +167,7 @@
+
diff --git a/HeliosDisplayManagement/Program.cs b/HeliosDisplayManagement/Program.cs
index 848141a..4ac61b7 100644
--- a/HeliosDisplayManagement/Program.cs
+++ b/HeliosDisplayManagement/Program.cs
@@ -22,10 +22,18 @@ using System.Net.NetworkInformation;
namespace HeliosDisplayManagement
{
+ public enum SupportedGameLibrary
+ {
+ Unknown,
+ Steam,
+ Uplay
+ }
+
internal static class Program
{
+
internal static Profile GetProfile(string profileName)
{
// Create an array of display profiles we have
@@ -90,12 +98,10 @@ namespace HeliosDisplayManagement
IPCService.GetInstance().Status = InstanceStatus.User;
new ShortcutForm(profile)
{
- FileName = executableToRun,
- SteamAppId = 0,
- UplayAppId = 0,
- Arguments = executableArguments,
- ProcessName = processToMonitor,
- Timeout = timeout
+ ExecutableNameAndPath = executableToRun,
+ ExecutableArguments = executableArguments,
+ ProcessNameToMonitor = processToMonitor,
+ ExecutableTimeout = timeout
}.ShowDialog();
}
@@ -105,12 +111,10 @@ namespace HeliosDisplayManagement
IPCService.GetInstance().Status = InstanceStatus.User;
new ShortcutForm(profile)
{
- FileName = null,
- SteamAppId = Convert.ToUInt32(steamGameIdToRun),
- UplayAppId = 0,
- Arguments = executableArguments,
- ProcessName = null,
- Timeout = timeout
+ GameLibrary = SupportedGameLibrary.Steam,
+ GameAppId = Convert.ToUInt32(steamGameIdToRun),
+ GameTimeout = timeout,
+ GameArguments = executableArguments,
}.ShowDialog();
}
@@ -120,12 +124,10 @@ namespace HeliosDisplayManagement
IPCService.GetInstance().Status = InstanceStatus.User;
new ShortcutForm(profile)
{
- FileName = null,
- SteamAppId = 0,
- UplayAppId = Convert.ToUInt32(uplayGameIdToRun),
- Arguments = executableArguments,
- ProcessName = null,
- Timeout = timeout
+ GameLibrary = SupportedGameLibrary.Uplay,
+ GameAppId = Convert.ToUInt32(uplayGameIdToRun),
+ GameTimeout = timeout,
+ GameArguments = executableArguments,
}.ShowDialog();
}
@@ -378,11 +380,18 @@ namespace HeliosDisplayManagement
});
+ app.OnExecute(() =>
+ {
+
+ Console.WriteLine("Starting Normally...");
+ StartUpNormally();
+ return 0;
+ });
+
try
{
// This begins the actual execution of the application
- Console.WriteLine("ConsoleArgs app executing...");
app.Execute(args);
}
catch (CommandParsingException ex)
diff --git a/HeliosDisplayManagement/Properties/DataSources/HeliosDisplayManagement.UIForms.ShortcutForm.datasource b/HeliosDisplayManagement/Properties/DataSources/HeliosDisplayManagement.UIForms.ShortcutForm.datasource
new file mode 100644
index 0000000..d505095
--- /dev/null
+++ b/HeliosDisplayManagement/Properties/DataSources/HeliosDisplayManagement.UIForms.ShortcutForm.datasource
@@ -0,0 +1,10 @@
+
+
+
+ HeliosDisplayManagement.UIForms.ShortcutForm, HeliosDisplayManagement, Version=0.9.6.23095, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/HeliosDisplayManagement/Properties/Resources.Designer.cs b/HeliosDisplayManagement/Properties/Resources.Designer.cs
index 9bbe775..bfbc723 100644
--- a/HeliosDisplayManagement/Properties/Resources.Designer.cs
+++ b/HeliosDisplayManagement/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace HeliosDisplayManagement.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/HeliosDisplayManagement/Resources/Language.Designer.cs b/HeliosDisplayManagement/Resources/Language.Designer.cs
index 9cbd6cc..b6fd5b7 100644
--- a/HeliosDisplayManagement/Resources/Language.Designer.cs
+++ b/HeliosDisplayManagement/Resources/Language.Designer.cs
@@ -19,7 +19,7 @@ namespace HeliosDisplayManagement.Resources {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Language {
diff --git a/HeliosDisplayManagement/UIForms/MainForm.Designer.cs b/HeliosDisplayManagement/UIForms/MainForm.Designer.cs
index 4ca8486..ec840bd 100644
--- a/HeliosDisplayManagement/UIForms/MainForm.Designer.cs
+++ b/HeliosDisplayManagement/UIForms/MainForm.Designer.cs
@@ -106,7 +106,7 @@ namespace HeliosDisplayManagement.UIForms
this.lbl_profile.Name = "lbl_profile";
this.lbl_profile.Size = new System.Drawing.Size(382, 13);
this.lbl_profile.TabIndex = 3;
- this.lbl_profile.Text = global::HeliosDisplayManagement.Resources.Language.None;
+ this.lbl_profile.Text = "[None]";
this.lbl_profile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btn_delete
@@ -206,6 +206,8 @@ namespace HeliosDisplayManagement.UIForms
| System.Windows.Forms.AnchorStyles.Left)));
this.lv_profiles.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(248)))));
this.lv_profiles.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.lv_profiles.GridLines = true;
+ this.lv_profiles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lv_profiles.HideSelection = false;
this.lv_profiles.LabelEdit = true;
this.lv_profiles.LargeImageList = this.il_profiles;
@@ -262,7 +264,7 @@ namespace HeliosDisplayManagement.UIForms
this.MinimumSize = new System.Drawing.Size(800, 400);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = global::HeliosDisplayManagement.Resources.Language.Helios_Display_Management;
+ this.Text = "Helios Display Management";
this.Activated += new System.EventHandler(this.MainForm_Activated);
this.Load += new System.EventHandler(this.MainForm_Load);
this.menu_profiles.ResumeLayout(false);
diff --git a/HeliosDisplayManagement/UIForms/MainForm.cs b/HeliosDisplayManagement/UIForms/MainForm.cs
index b6dfccc..e0207c5 100644
--- a/HeliosDisplayManagement/UIForms/MainForm.cs
+++ b/HeliosDisplayManagement/UIForms/MainForm.cs
@@ -204,6 +204,8 @@ namespace HeliosDisplayManagement.UIForms
btn_edit.PerformClick();
}
+ // Need to check why we did it this way rather than just using the
+ // list items themselves for clicking? That way we'd avoid selecting nothing...
private void lv_profiles_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && lv_profiles.SelectedItems.Count > 0)
@@ -224,37 +226,54 @@ namespace HeliosDisplayManagement.UIForms
{
if (lv_profiles.SelectedItems.Count > 0)
{
- dv_profile.Profile =
- lv_profiles.SelectedItems[0].Tag as Profile ?? Profile.GetCurrent(Language.Current);
+ dv_profile.Profile = lv_profiles.SelectedItems[0].Tag as Profile ?? Profile.GetCurrent(Language.Current);
}
else
{
dv_profile.Profile = null;
}
+ // Set the Profile name
lbl_profile.Text = dv_profile.Profile?.Name ?? Language.None;
- applyToolStripMenuItem.Enabled =
- btn_apply.Enabled = dv_profile.Profile != null &&
- lv_profiles.SelectedItems[0].Tag != null &&
- !dv_profile.Profile.IsActive;
- editToolStripMenuItem.Enabled =
- btn_edit.Enabled = dv_profile.Profile != null && lv_profiles.SelectedItems[0].Tag != null;
- deleteToolStripMenuItem.Enabled =
- btn_delete.Enabled = dv_profile.Profile != null && lv_profiles.SelectedItems[0].Tag != null;
- cloneToolStripMenuItem.Enabled = btn_clone.Enabled = dv_profile.Profile != null;
- createShortcutToolStripMenuItem.Enabled =
- btn_shortcut.Enabled = dv_profile.Profile != null && lv_profiles.SelectedItems[0].Tag != null;
+
+ // Turn on the buttons if the
+ if (dv_profile.Profile != null) {
+ if (lv_profiles.SelectedItems[0].Tag != null)
+ {
+ editToolStripMenuItem.Enabled = true;
+ btn_edit.Enabled = true;
+ deleteToolStripMenuItem.Enabled = true;
+ btn_delete.Enabled = true;
+ createShortcutToolStripMenuItem.Enabled = true;
+ btn_shortcut.Enabled = true;
+
+ if (!dv_profile.Profile.IsActive)
+ {
+ applyToolStripMenuItem.Enabled = true;
+ btn_apply.Enabled = true;
+ }
+ }
+ cloneToolStripMenuItem.Enabled = true;
+ btn_clone.Enabled = true;
+
+ }
+
+ // Refresh the profiles again in case anything changed
RefreshProfilesStatus();
}
private void MainForm_Activated(object sender, EventArgs e)
{
- ReloadProfiles();
+ //ReloadProfiles();
}
private void MainForm_Load(object sender, EventArgs e)
{
ReloadProfiles();
+ // Select the first item in the profiles list so pressing the buttons makes sense!
+ lv_profiles.Items[0].Selected = true;
+ lv_profiles.Items[0].Focused = true;
+ lv_profiles.Items[0].Checked = true;
}
private void RefreshProfilesStatus()
diff --git a/HeliosDisplayManagement/UIForms/ShortcutForm.Designer.cs b/HeliosDisplayManagement/UIForms/ShortcutForm.Designer.cs
index d75d912..6ffe7ac 100644
--- a/HeliosDisplayManagement/UIForms/ShortcutForm.Designer.cs
+++ b/HeliosDisplayManagement/UIForms/ShortcutForm.Designer.cs
@@ -34,31 +34,34 @@ namespace HeliosDisplayManagement.UIForms
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShortcutForm));
this.btn_save = new System.Windows.Forms.Button();
this.btn_cancel = new System.Windows.Forms.Button();
- this.g_temp = new System.Windows.Forms.GroupBox();
- this.p_steam = new System.Windows.Forms.Panel();
+ this.g_temporary = new System.Windows.Forms.GroupBox();
+ this.p_game = new System.Windows.Forms.Panel();
+ this.txt_game_name = new System.Windows.Forms.TextBox();
+ this.nud_game_appid = new System.Windows.Forms.NumericUpDown();
+ this.cmb_game_launcher = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.btn_choose_game = new System.Windows.Forms.Button();
- this.treeView1 = new System.Windows.Forms.TreeView();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.cb_arg_launcher = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.tree_games = new System.Windows.Forms.TreeView();
+ this.txt_args_game = new System.Windows.Forms.TextBox();
+ this.cb_args_game = new System.Windows.Forms.CheckBox();
this.nud_steamapps = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
- this.nud_steamtimeout = new System.Windows.Forms.NumericUpDown();
+ this.nud_timeout_game = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
- this.nud_appid = new System.Windows.Forms.NumericUpDown();
this.p_standalone = new System.Windows.Forms.Panel();
this.txt_args_executable = new System.Windows.Forms.TextBox();
this.cb_args_executable = new System.Windows.Forms.CheckBox();
this.btn_app_process = new System.Windows.Forms.Button();
- this.txt_process = new System.Windows.Forms.TextBox();
+ this.txt_process_name = new System.Windows.Forms.TextBox();
this.rb_wait_process = new System.Windows.Forms.RadioButton();
this.rb_wait_executable = new System.Windows.Forms.RadioButton();
this.btn_app_executable = new System.Windows.Forms.Button();
this.txt_executable = new System.Windows.Forms.TextBox();
this.lbl_app_executable = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
- this.nud_timeout = new System.Windows.Forms.NumericUpDown();
+ this.nud_timeout_executable = new System.Windows.Forms.NumericUpDown();
this.rb_launcher = new System.Windows.Forms.RadioButton();
this.rb_standalone = new System.Windows.Forms.RadioButton();
this.dv_profile = new HeliosDisplayManagement.Shared.UserControls.DisplayView();
@@ -66,15 +69,13 @@ namespace HeliosDisplayManagement.UIForms
this.dialog_save = new System.Windows.Forms.SaveFileDialog();
this.rb_switch_perm = new System.Windows.Forms.RadioButton();
this.rb_switch_temp = new System.Windows.Forms.RadioButton();
- this.cb_game_launcher = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.g_temp.SuspendLayout();
- this.p_steam.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nud_steamtimeout)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.nud_appid)).BeginInit();
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ this.g_temporary.SuspendLayout();
+ this.p_game.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_game_appid)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).BeginInit();
this.p_standalone.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nud_timeout)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_executable)).BeginInit();
this.SuspendLayout();
//
// btn_save
@@ -97,41 +98,80 @@ namespace HeliosDisplayManagement.UIForms
this.btn_cancel.Text = "&Back";
this.btn_cancel.UseVisualStyleBackColor = true;
//
- // g_temp
+ // g_temporary
//
- this.g_temp.Controls.Add(this.p_steam);
- this.g_temp.Controls.Add(this.p_standalone);
- this.g_temp.Controls.Add(this.rb_launcher);
- this.g_temp.Controls.Add(this.rb_standalone);
- this.g_temp.Enabled = false;
- this.g_temp.Location = new System.Drawing.Point(12, 388);
- this.g_temp.Name = "g_temp";
- this.g_temp.Size = new System.Drawing.Size(786, 355);
- this.g_temp.TabIndex = 4;
- this.g_temp.TabStop = false;
- this.g_temp.Text = "Application or Game Information";
+ this.g_temporary.Controls.Add(this.p_game);
+ this.g_temporary.Controls.Add(this.p_standalone);
+ this.g_temporary.Controls.Add(this.rb_launcher);
+ this.g_temporary.Controls.Add(this.rb_standalone);
+ this.g_temporary.Location = new System.Drawing.Point(12, 388);
+ this.g_temporary.Name = "g_temporary";
+ this.g_temporary.Size = new System.Drawing.Size(786, 355);
+ this.g_temporary.TabIndex = 4;
+ this.g_temporary.TabStop = false;
+ this.g_temporary.Text = "Application or Game Information";
//
- // p_steam
+ // p_game
//
- this.p_steam.Controls.Add(this.textBox2);
- this.p_steam.Controls.Add(this.nud_appid);
- this.p_steam.Controls.Add(this.cb_game_launcher);
- this.p_steam.Controls.Add(this.label6);
- this.p_steam.Controls.Add(this.label4);
- this.p_steam.Controls.Add(this.btn_choose_game);
- this.p_steam.Controls.Add(this.label1);
- this.p_steam.Controls.Add(this.treeView1);
- this.p_steam.Controls.Add(this.textBox1);
- this.p_steam.Controls.Add(this.cb_arg_launcher);
- this.p_steam.Controls.Add(this.nud_steamapps);
- this.p_steam.Controls.Add(this.label5);
- this.p_steam.Controls.Add(this.nud_steamtimeout);
- this.p_steam.Controls.Add(this.label3);
- this.p_steam.Enabled = false;
- this.p_steam.Location = new System.Drawing.Point(26, 198);
- this.p_steam.Name = "p_steam";
- this.p_steam.Size = new System.Drawing.Size(730, 145);
- this.p_steam.TabIndex = 3;
+ this.p_game.Controls.Add(this.txt_game_name);
+ this.p_game.Controls.Add(this.nud_game_appid);
+ this.p_game.Controls.Add(this.cmb_game_launcher);
+ this.p_game.Controls.Add(this.label6);
+ this.p_game.Controls.Add(this.label4);
+ this.p_game.Controls.Add(this.btn_choose_game);
+ this.p_game.Controls.Add(this.label1);
+ this.p_game.Controls.Add(this.tree_games);
+ this.p_game.Controls.Add(this.txt_args_game);
+ this.p_game.Controls.Add(this.cb_args_game);
+ this.p_game.Controls.Add(this.nud_steamapps);
+ this.p_game.Controls.Add(this.label5);
+ this.p_game.Controls.Add(this.nud_timeout_game);
+ this.p_game.Controls.Add(this.label3);
+ this.p_game.Enabled = false;
+ this.p_game.Location = new System.Drawing.Point(26, 198);
+ this.p_game.Name = "p_game";
+ this.p_game.Size = new System.Drawing.Size(730, 145);
+ this.p_game.TabIndex = 3;
+ //
+ // txt_game_name
+ //
+ this.txt_game_name.Location = new System.Drawing.Point(408, 73);
+ this.txt_game_name.Name = "txt_game_name";
+ this.txt_game_name.ReadOnly = true;
+ this.txt_game_name.Size = new System.Drawing.Size(302, 20);
+ this.txt_game_name.TabIndex = 21;
+ //
+ // nud_game_appid
+ //
+ this.nud_game_appid.Enabled = false;
+ this.nud_game_appid.Location = new System.Drawing.Point(408, 45);
+ this.nud_game_appid.Maximum = new decimal(new int[] {
+ 1410065407,
+ 2,
+ 0,
+ 0});
+ this.nud_game_appid.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.nud_game_appid.Name = "nud_game_appid";
+ this.nud_game_appid.Size = new System.Drawing.Size(89, 20);
+ this.nud_game_appid.TabIndex = 1;
+ this.nud_game_appid.Value = new decimal(new int[] {
+ 730,
+ 0,
+ 0,
+ 0});
+ this.nud_game_appid.ValueChanged += new System.EventHandler(this.nud_game_appid_ValueChanged);
+ //
+ // cmb_game_launcher
+ //
+ this.cmb_game_launcher.FormattingEnabled = true;
+ this.cmb_game_launcher.Location = new System.Drawing.Point(408, 18);
+ this.cmb_game_launcher.Name = "cmb_game_launcher";
+ this.cmb_game_launcher.Size = new System.Drawing.Size(163, 21);
+ this.cmb_game_launcher.TabIndex = 20;
//
// label6
//
@@ -161,31 +201,42 @@ namespace HeliosDisplayManagement.UIForms
this.btn_choose_game.Text = ">>";
this.btn_choose_game.UseVisualStyleBackColor = true;
//
- // treeView1
+ // label1
//
- this.treeView1.Location = new System.Drawing.Point(6, 19);
- this.treeView1.Name = "treeView1";
- this.treeView1.Size = new System.Drawing.Size(212, 120);
- this.treeView1.TabIndex = 14;
+ this.label1.AutoSize = true;
+ this.label1.BackColor = System.Drawing.Color.Transparent;
+ this.label1.Location = new System.Drawing.Point(72, 11);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(88, 13);
+ this.label1.TabIndex = 15;
+ this.label1.Text = "Games detected:";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
- // textBox1
+ // tree_games
//
- this.textBox1.Enabled = false;
- this.textBox1.Location = new System.Drawing.Point(408, 100);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(302, 20);
- this.textBox1.TabIndex = 13;
+ this.tree_games.Location = new System.Drawing.Point(6, 19);
+ this.tree_games.Name = "tree_games";
+ this.tree_games.Size = new System.Drawing.Size(212, 120);
+ this.tree_games.TabIndex = 14;
//
- // cb_arg_launcher
+ // txt_args_game
//
- this.cb_arg_launcher.AutoSize = true;
- this.cb_arg_launcher.Location = new System.Drawing.Point(265, 102);
- this.cb_arg_launcher.Name = "cb_arg_launcher";
- this.cb_arg_launcher.Size = new System.Drawing.Size(147, 17);
- this.cb_arg_launcher.TabIndex = 12;
- this.cb_arg_launcher.Text = "Pass arguments to Game:";
- this.cb_arg_launcher.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.cb_arg_launcher.UseVisualStyleBackColor = true;
+ this.txt_args_game.Enabled = false;
+ this.txt_args_game.Location = new System.Drawing.Point(408, 100);
+ this.txt_args_game.Name = "txt_args_game";
+ this.txt_args_game.Size = new System.Drawing.Size(302, 20);
+ this.txt_args_game.TabIndex = 13;
+ //
+ // cb_args_game
+ //
+ this.cb_args_game.AutoSize = true;
+ this.cb_args_game.Location = new System.Drawing.Point(265, 102);
+ this.cb_args_game.Name = "cb_args_game";
+ this.cb_args_game.Size = new System.Drawing.Size(147, 17);
+ this.cb_args_game.TabIndex = 12;
+ this.cb_args_game.Text = "Pass arguments to Game:";
+ this.cb_args_game.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.cb_args_game.UseVisualStyleBackColor = true;
//
// nud_steamapps
//
@@ -195,7 +246,6 @@ namespace HeliosDisplayManagement.UIForms
this.nud_steamapps.TabIndex = 2;
this.nud_steamapps.Text = "...";
this.nud_steamapps.UseVisualStyleBackColor = true;
- this.nud_steamapps.Click += new System.EventHandler(this.nud_steamapps_Click);
//
// label5
//
@@ -206,27 +256,28 @@ namespace HeliosDisplayManagement.UIForms
this.label5.TabIndex = 4;
this.label5.Text = "Timeout:";
//
- // nud_steamtimeout
+ // nud_timeout_game
//
- this.nud_steamtimeout.Location = new System.Drawing.Point(640, 17);
- this.nud_steamtimeout.Maximum = new decimal(new int[] {
+ this.nud_timeout_game.Location = new System.Drawing.Point(640, 17);
+ this.nud_timeout_game.Maximum = new decimal(new int[] {
240,
0,
0,
0});
- this.nud_steamtimeout.Minimum = new decimal(new int[] {
+ this.nud_timeout_game.Minimum = new decimal(new int[] {
5,
0,
0,
0});
- this.nud_steamtimeout.Name = "nud_steamtimeout";
- this.nud_steamtimeout.Size = new System.Drawing.Size(70, 20);
- this.nud_steamtimeout.TabIndex = 5;
- this.nud_steamtimeout.Value = new decimal(new int[] {
+ this.nud_timeout_game.Name = "nud_timeout_game";
+ this.nud_timeout_game.Size = new System.Drawing.Size(70, 20);
+ this.nud_timeout_game.TabIndex = 5;
+ this.nud_timeout_game.Value = new decimal(new int[] {
120,
0,
0,
0});
+ this.nud_timeout_game.ValueChanged += new System.EventHandler(this.nud_timeout_game_ValueChanged);
//
// label3
//
@@ -238,42 +289,19 @@ namespace HeliosDisplayManagement.UIForms
this.label3.Text = "Game ID:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
- // nud_appid
- //
- this.nud_appid.Location = new System.Drawing.Point(408, 45);
- this.nud_appid.Maximum = new decimal(new int[] {
- 1410065407,
- 2,
- 0,
- 0});
- this.nud_appid.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nud_appid.Name = "nud_appid";
- this.nud_appid.Size = new System.Drawing.Size(89, 20);
- this.nud_appid.TabIndex = 1;
- this.nud_appid.Value = new decimal(new int[] {
- 730,
- 0,
- 0,
- 0});
- this.nud_appid.ValueChanged += new System.EventHandler(this.nud_steamappid_ValueChanged);
- //
// p_standalone
//
this.p_standalone.Controls.Add(this.txt_args_executable);
this.p_standalone.Controls.Add(this.cb_args_executable);
this.p_standalone.Controls.Add(this.btn_app_process);
- this.p_standalone.Controls.Add(this.txt_process);
+ this.p_standalone.Controls.Add(this.txt_process_name);
this.p_standalone.Controls.Add(this.rb_wait_process);
this.p_standalone.Controls.Add(this.rb_wait_executable);
this.p_standalone.Controls.Add(this.btn_app_executable);
this.p_standalone.Controls.Add(this.txt_executable);
this.p_standalone.Controls.Add(this.lbl_app_executable);
this.p_standalone.Controls.Add(this.label2);
- this.p_standalone.Controls.Add(this.nud_timeout);
+ this.p_standalone.Controls.Add(this.nud_timeout_executable);
this.p_standalone.Location = new System.Drawing.Point(26, 42);
this.p_standalone.Name = "p_standalone";
this.p_standalone.Size = new System.Drawing.Size(730, 118);
@@ -286,6 +314,7 @@ namespace HeliosDisplayManagement.UIForms
this.txt_args_executable.Name = "txt_args_executable";
this.txt_args_executable.Size = new System.Drawing.Size(520, 20);
this.txt_args_executable.TabIndex = 11;
+ this.txt_args_executable.TextChanged += new System.EventHandler(this.txt_args_executable_TextChanged);
//
// cb_args_executable
//
@@ -307,36 +336,39 @@ namespace HeliosDisplayManagement.UIForms
this.btn_app_process.TabIndex = 9;
this.btn_app_process.Text = "Choose";
this.btn_app_process.UseVisualStyleBackColor = true;
+ this.btn_app_process.Click += new System.EventHandler(this.btn_app_process_Click);
//
- // txt_process
+ // txt_process_name
//
- this.txt_process.Enabled = false;
- this.txt_process.Location = new System.Drawing.Point(323, 56);
- this.txt_process.Name = "txt_process";
- this.txt_process.Size = new System.Drawing.Size(198, 20);
- this.txt_process.TabIndex = 4;
+ this.txt_process_name.Enabled = false;
+ this.txt_process_name.Location = new System.Drawing.Point(296, 56);
+ this.txt_process_name.Name = "txt_process_name";
+ this.txt_process_name.Size = new System.Drawing.Size(225, 20);
+ this.txt_process_name.TabIndex = 4;
//
// rb_wait_process
//
this.rb_wait_process.AutoSize = true;
this.rb_wait_process.Location = new System.Drawing.Point(6, 59);
this.rb_wait_process.Name = "rb_wait_process";
- this.rb_wait_process.Size = new System.Drawing.Size(311, 17);
+ this.rb_wait_process.Size = new System.Drawing.Size(296, 17);
this.rb_wait_process.TabIndex = 8;
- this.rb_wait_process.TabStop = true;
- this.rb_wait_process.Text = "Revert to default Display Profile when this process is closed: ";
+ this.rb_wait_process.Text = "Change Display Profile back when this process is closed: ";
this.rb_wait_process.UseVisualStyleBackColor = true;
+ this.rb_wait_process.CheckedChanged += new System.EventHandler(this.rb_wait_process_CheckedChanged);
//
// rb_wait_executable
//
this.rb_wait_executable.AutoSize = true;
+ this.rb_wait_executable.Checked = true;
this.rb_wait_executable.Location = new System.Drawing.Point(6, 37);
this.rb_wait_executable.Name = "rb_wait_executable";
- this.rb_wait_executable.Size = new System.Drawing.Size(319, 17);
+ this.rb_wait_executable.Size = new System.Drawing.Size(304, 17);
this.rb_wait_executable.TabIndex = 7;
this.rb_wait_executable.TabStop = true;
- this.rb_wait_executable.Text = "Revert to default Display Profile when the executable is closed";
+ this.rb_wait_executable.Text = "Change Display Profile back when the executable is closed";
this.rb_wait_executable.UseVisualStyleBackColor = true;
+ this.rb_wait_executable.CheckedChanged += new System.EventHandler(this.rb_wait_executable_CheckedChanged);
//
// btn_app_executable
//
@@ -375,28 +407,29 @@ namespace HeliosDisplayManagement.UIForms
this.label2.TabIndex = 5;
this.label2.Text = "Timeout";
//
- // nud_timeout
+ // nud_timeout_executable
//
- this.nud_timeout.Enabled = false;
- this.nud_timeout.Location = new System.Drawing.Point(640, 6);
- this.nud_timeout.Maximum = new decimal(new int[] {
+ this.nud_timeout_executable.Enabled = false;
+ this.nud_timeout_executable.Location = new System.Drawing.Point(640, 6);
+ this.nud_timeout_executable.Maximum = new decimal(new int[] {
240,
0,
0,
0});
- this.nud_timeout.Minimum = new decimal(new int[] {
+ this.nud_timeout_executable.Minimum = new decimal(new int[] {
5,
0,
0,
0});
- this.nud_timeout.Name = "nud_timeout";
- this.nud_timeout.Size = new System.Drawing.Size(70, 20);
- this.nud_timeout.TabIndex = 6;
- this.nud_timeout.Value = new decimal(new int[] {
+ this.nud_timeout_executable.Name = "nud_timeout_executable";
+ this.nud_timeout_executable.Size = new System.Drawing.Size(70, 20);
+ this.nud_timeout_executable.TabIndex = 6;
+ this.nud_timeout_executable.Value = new decimal(new int[] {
30,
0,
0,
0});
+ this.nud_timeout_executable.ValueChanged += new System.EventHandler(this.nud_timeout_executable_ValueChanged);
//
// rb_launcher
//
@@ -407,7 +440,7 @@ namespace HeliosDisplayManagement.UIForms
this.rb_launcher.TabIndex = 2;
this.rb_launcher.Text = "Launch Game already installed by Steam or Uplay";
this.rb_launcher.UseVisualStyleBackColor = true;
- this.rb_launcher.CheckedChanged += new System.EventHandler(this.Controls_CheckedChanged);
+ this.rb_launcher.CheckedChanged += new System.EventHandler(this.rb_launcher_CheckedChanged);
//
// rb_standalone
//
@@ -420,7 +453,7 @@ namespace HeliosDisplayManagement.UIForms
this.rb_standalone.TabStop = true;
this.rb_standalone.Text = "Standalone Application or Game";
this.rb_standalone.UseVisualStyleBackColor = true;
- this.rb_standalone.CheckedChanged += new System.EventHandler(this.Controls_CheckedChanged);
+ this.rb_standalone.CheckedChanged += new System.EventHandler(this.rb_standalone_CheckedChanged);
//
// dv_profile
//
@@ -463,7 +496,7 @@ namespace HeliosDisplayManagement.UIForms
this.rb_switch_perm.TabIndex = 7;
this.rb_switch_perm.Text = "Switch to the Display Profile permanently";
this.rb_switch_perm.UseVisualStyleBackColor = true;
- this.rb_switch_perm.CheckedChanged += new System.EventHandler(this.rb_switch_temp_CheckedChanged);
+ this.rb_switch_perm.CheckedChanged += new System.EventHandler(this.rb_switch_perm_CheckedChanged);
//
// rb_switch_temp
//
@@ -478,33 +511,10 @@ namespace HeliosDisplayManagement.UIForms
this.rb_switch_temp.UseVisualStyleBackColor = true;
this.rb_switch_temp.CheckedChanged += new System.EventHandler(this.rb_switch_temp_CheckedChanged);
//
- // cb_game_launcher
+ // openFileDialog1
//
- this.cb_game_launcher.FormattingEnabled = true;
- this.cb_game_launcher.Location = new System.Drawing.Point(408, 18);
- this.cb_game_launcher.Name = "cb_game_launcher";
- this.cb_game_launcher.Size = new System.Drawing.Size(163, 21);
- this.cb_game_launcher.TabIndex = 20;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.Location = new System.Drawing.Point(72, 11);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(88, 13);
- this.label1.TabIndex = 15;
- this.label1.Text = "Games detected:";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.label1.Click += new System.EventHandler(this.label1_Click);
- //
- // textBox2
- //
- this.textBox2.Location = new System.Drawing.Point(408, 73);
- this.textBox2.Name = "textBox2";
- this.textBox2.ReadOnly = true;
- this.textBox2.Size = new System.Drawing.Size(302, 20);
- this.textBox2.TabIndex = 21;
+ this.openFileDialog1.FileName = "openFileDialog1";
+ this.openFileDialog1.Title = "Title";
//
// ShortcutForm
//
@@ -516,7 +526,7 @@ namespace HeliosDisplayManagement.UIForms
this.ClientSize = new System.Drawing.Size(810, 782);
this.Controls.Add(this.rb_switch_temp);
this.Controls.Add(this.rb_switch_perm);
- this.Controls.Add(this.g_temp);
+ this.Controls.Add(this.g_temporary);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_save);
this.Controls.Add(this.dv_profile);
@@ -528,15 +538,16 @@ namespace HeliosDisplayManagement.UIForms
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Create Shortcut";
- this.g_temp.ResumeLayout(false);
- this.g_temp.PerformLayout();
- this.p_steam.ResumeLayout(false);
- this.p_steam.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nud_steamtimeout)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.nud_appid)).EndInit();
+ this.Load += new System.EventHandler(this.ShortcutForm_Load);
+ this.g_temporary.ResumeLayout(false);
+ this.g_temporary.PerformLayout();
+ this.p_game.ResumeLayout(false);
+ this.p_game.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_game_appid)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).EndInit();
this.p_standalone.ResumeLayout(false);
this.p_standalone.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nud_timeout)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_executable)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -547,21 +558,21 @@ namespace HeliosDisplayManagement.UIForms
private DisplayView dv_profile;
private System.Windows.Forms.Button btn_save;
private System.Windows.Forms.Button btn_cancel;
- private System.Windows.Forms.GroupBox g_temp;
+ private System.Windows.Forms.GroupBox g_temporary;
private System.Windows.Forms.RadioButton rb_standalone;
private System.Windows.Forms.Label label2;
- private System.Windows.Forms.NumericUpDown nud_timeout;
+ private System.Windows.Forms.NumericUpDown nud_timeout_executable;
private System.Windows.Forms.Panel p_standalone;
private System.Windows.Forms.Button btn_app_executable;
private System.Windows.Forms.TextBox txt_executable;
private System.Windows.Forms.Label lbl_app_executable;
- private System.Windows.Forms.TextBox txt_process;
+ private System.Windows.Forms.TextBox txt_process_name;
private System.Windows.Forms.RadioButton rb_launcher;
- private System.Windows.Forms.Panel p_steam;
+ private System.Windows.Forms.Panel p_game;
private System.Windows.Forms.Label label3;
- private System.Windows.Forms.NumericUpDown nud_appid;
+ private System.Windows.Forms.NumericUpDown nud_game_appid;
private System.Windows.Forms.Label label5;
- private System.Windows.Forms.NumericUpDown nud_steamtimeout;
+ private System.Windows.Forms.NumericUpDown nud_timeout_game;
private System.Windows.Forms.Button nud_steamapps;
private System.Windows.Forms.OpenFileDialog dialog_open;
private System.Windows.Forms.SaveFileDialog dialog_save;
@@ -570,16 +581,17 @@ namespace HeliosDisplayManagement.UIForms
private System.Windows.Forms.RadioButton rb_wait_process;
private System.Windows.Forms.RadioButton rb_wait_executable;
private System.Windows.Forms.Button btn_app_process;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.CheckBox cb_arg_launcher;
+ private System.Windows.Forms.TextBox txt_args_game;
+ private System.Windows.Forms.CheckBox cb_args_game;
private System.Windows.Forms.TextBox txt_args_executable;
private System.Windows.Forms.CheckBox cb_args_executable;
- private System.Windows.Forms.TreeView treeView1;
+ private System.Windows.Forms.TreeView tree_games;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btn_choose_game;
- private System.Windows.Forms.ComboBox cb_game_launcher;
+ private System.Windows.Forms.ComboBox cmb_game_launcher;
private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.TextBox txt_game_name;
+ private System.Windows.Forms.OpenFileDialog openFileDialog1;
}
}
\ No newline at end of file
diff --git a/HeliosDisplayManagement/UIForms/ShortcutForm.cs b/HeliosDisplayManagement/UIForms/ShortcutForm.cs
index 103274d..b6f7c15 100644
--- a/HeliosDisplayManagement/UIForms/ShortcutForm.cs
+++ b/HeliosDisplayManagement/UIForms/ShortcutForm.cs
@@ -8,6 +8,7 @@ using System.Windows.Forms;
using HeliosDisplayManagement.Resources;
using HeliosDisplayManagement.Shared;
using HeliosDisplayManagement.Steam;
+using NvAPIWrapper.Native.GPU;
namespace HeliosDisplayManagement.UIForms
{
@@ -23,29 +24,6 @@ namespace HeliosDisplayManagement.UIForms
Profile = profile;
}
- public string Arguments
- {
- get => rb_args.Checked ? txt_args_executable.Text : string.Empty;
- set
- {
- txt_args_executable.Text = value;
- rb_args.Checked = !string.IsNullOrWhiteSpace(txt_args_executable.Text);
- }
- }
-
- public string FileName
- {
- get => cb_temp.Checked && rb_standalone.Checked ? txt_executable.Text : string.Empty;
- set
- {
- if (!string.IsNullOrWhiteSpace(value))
- {
- cb_temp.Checked = true;
- rb_standalone.Checked = true;
- txt_executable.Text = value;
- }
- }
- }
public static string IconCache
{
@@ -53,13 +31,25 @@ namespace HeliosDisplayManagement.UIForms
Assembly.GetExecutingAssembly().GetName().Name, @"IconCache");
}
- public string ProcessName
+ public string ProcessNameToMonitor
{
- get => cb_temp.Checked && rb_standalone.Checked && cb_process.Checked ? txt_process.Text : string.Empty;
+ get
+ {
+ if (rb_switch_temp.Checked && rb_standalone.Checked) {
+ if (rb_wait_executable.Checked)
+ {
+ return txt_process_name.Text;
+ }
+ }
+ return string.Empty;
+ }
set
{
- txt_process.Text = value;
- cb_process.Checked = !string.IsNullOrWhiteSpace(txt_process.Text);
+ if (File.Exists(txt_executable.Text))
+ {
+ txt_process_name.Text = value;
+ rb_wait_executable.Checked = true;
+ }
}
}
@@ -69,51 +59,121 @@ namespace HeliosDisplayManagement.UIForms
set => dv_profile.Profile = value;
}
- public uint SteamAppId
+
+ public string ExecutableNameAndPath
{
- get => cb_temp.Checked && rb_launcher.Checked ? (uint) nud_appid.Value : 0;
+ get => rb_switch_temp.Checked && rb_launcher.Checked ? txt_executable.Text : string.Empty;
set
{
- if (value > 0)
+ if (File.Exists(txt_executable.Text))
{
- cb_temp.Checked = true;
+ rb_switch_temp.Checked = true;
rb_launcher.Checked = true;
- nud_appid.Value = value;
+ txt_executable.Text = value;
}
}
}
- public uint Timeout
+ public uint ExecutableTimeout
{
get
{
- if (!cb_temp.Checked)
- {
- return 0;
- }
- if (!rb_standalone.Checked)
+ if (rb_wait_executable.Checked)
{
- return (uint) nud_steamtimeout.Value;
- }
-
- if (cb_process.Checked)
- {
- return (uint) nud_timeout.Value;
+ return (uint)nud_timeout_executable.Value;
}
return 0;
}
set
{
- if (value > 0)
- {
- nud_timeout.Value = value;
- nud_steamtimeout.Value = value;
- }
+ nud_timeout_executable.Value = value;
}
}
+ public string ExecutableArguments
+ {
+ get => cb_args_executable.Checked ? txt_args_executable.Text : string.Empty;
+ set
+ {
+ txt_args_executable.Text = value;
+ cb_args_executable.Checked = true;
+ }
+ }
+
+
+ public uint GameAppId
+ {
+ get => rb_switch_temp.Checked && rb_launcher.Checked ? (uint) nud_game_appid.Value : 0;
+ set
+ {
+ rb_switch_temp.Checked = true;
+ rb_launcher.Checked = true;
+ nud_game_appid.Value = value;
+ }
+ }
+
+ public string GameName
+ {
+ get => rb_switch_temp.Checked && rb_launcher.Checked ? txt_game_name.Text : string.Empty;
+ set
+ {
+ rb_switch_temp.Checked = true;
+ rb_launcher.Checked = true;
+ txt_game_name.Text = value;
+ }
+ }
+
+ public SupportedGameLibrary GameLibrary
+ {
+ get => rb_switch_temp.Checked && rb_launcher.Checked ? (SupportedGameLibrary) nud_game_appid.Value : SupportedGameLibrary.Unknown;
+ set
+ {
+ rb_switch_temp.Checked = true;
+ rb_launcher.Checked = true;
+ switch (value)
+ {
+ case SupportedGameLibrary.Steam:
+ break;
+
+ case SupportedGameLibrary.Uplay:
+ break;
+
+ }
+ // TODO - If SupportedGameLibrary.Unknown; then we need to show an error message.
+
+ }
+ }
+
+
+ public uint GameTimeout
+ {
+ get
+ {
+ if (rb_switch_temp.Checked && rb_launcher.Checked)
+ {
+ return (uint)nud_timeout_game.Value;
+ }
+ return 0;
+ }
+ set
+ {
+ nud_timeout_game.Value = value;
+ }
+ }
+
+ public string GameArguments
+ {
+ get => cb_args_game.Checked ? txt_args_game.Text : string.Empty;
+ set
+ {
+ txt_args_game.Text = value;
+ cb_args_game.Checked = true;
+ }
+ }
+
+
private void btn_app_executable_Click(object sender, EventArgs e)
{
if (dialog_open.ShowDialog(this) == DialogResult.OK)
@@ -169,24 +229,6 @@ namespace HeliosDisplayManagement.UIForms
}
}
- private void Controls_CheckedChanged(object sender, EventArgs e)
- {
- g_temp.Enabled = cb_temp.Checked;
-
- p_standalone.Enabled = rb_standalone.Checked;
- txt_process.Enabled = cb_process.Checked;
- nud_timeout.Enabled = cb_process.Checked;
-
- p_steam.Enabled = rb_launcher.Checked;
-
- txt_args_executable.Enabled = cb_args.Checked;
-
- if (rb_launcher.Checked)
- {
- nud_steamappid_ValueChanged(rb_launcher, e);
- }
- }
-
// ReSharper disable once FunctionComplexityOverflow
// ReSharper disable once CyclomaticComplexity
private bool CreateShortcut(string fileName)
@@ -194,10 +236,13 @@ namespace HeliosDisplayManagement.UIForms
var programName = Path.GetFileNameWithoutExtension(txt_executable.Text);
var description = string.Empty;
var icon = string.Empty;
+
var args = new List
{
- $"-a {HeliosStartupAction.SwitchProfile}",
- $"-p \"{dv_profile.Profile.Id}\""
+ // Add the SwitchProfile command as the first argument to start to switch to another profile
+ $"{HeliosStartupAction.SwitchProfile}",
+ // Add the Profile Name as the second argument (use that rather than ID - though ID still will work!)
+ $"--profile \"{dv_profile.Profile.Name}\""
};
if (!Directory.Exists(IconCache))
@@ -212,30 +257,50 @@ namespace HeliosDisplayManagement.UIForms
}
}
- if (cb_temp.Checked)
+ // Only add the rest of the options if the temporary switch radio button is set
+ if (rb_switch_temp.Checked)
{
+ // Only add this set of options if the standalone programme radio button is set
if (rb_standalone.Checked)
{
+ // Doublecheck the Executable text field is filled in
if (string.IsNullOrWhiteSpace(txt_executable.Text))
{
throw new Exception(Language.Executable_address_can_not_be_empty);
}
+ // Doublecheck the Executable text field is a path to a real file
if (!File.Exists(txt_executable.Text))
{
throw new Exception(Language.Executable_file_not_found);
}
- args.Add($"-e \"{txt_executable.Text.Trim()}\"");
+ // Add the executable command and the executable name to the shortcut arguments
+ args.Add($"execute \"{txt_executable.Text.Trim()}\"");
- if (!string.IsNullOrWhiteSpace(txt_process.Text))
+ // Check that the wait for executable radiobutton is on
+ if (rb_wait_executable.Checked)
{
- args.Add($"-w \"{txt_process.Text.Trim()}\"");
- args.Add($"-t {(int) nud_timeout.Value}");
+ // Doublecheck the process name has text in it
+ if (!string.IsNullOrWhiteSpace(txt_process_name.Text))
+ {
+ // Add the waitfor argument and the process name to the shortcut arguments
+ args.Add($"--waitfor \"{txt_process_name.Text.Trim()}\"");
+ }
}
+ // Add the timeout argument and the timeout duration in seconds to the shortcut arguments
+ args.Add($"--timeout {(int)nud_timeout_executable.Value}");
+
+ if (cb_args_executable.Checked && !string.IsNullOrWhiteSpace(txt_args_executable.Text))
+ {
+ args.Add($"--arguments \"{txt_args_executable.Text.Trim()}\"");
+ }
+
+ // Prepare text for the shortcut description field
description = string.Format(Language.Executing_application_with_profile, programName, Profile.Name);
+ // Grab an icon for the selected executable
try
{
icon = Path.Combine(IconCache, Guid.NewGuid() + ".ico");
@@ -247,20 +312,36 @@ namespace HeliosDisplayManagement.UIForms
icon = $"{txt_executable.Text.Trim()},0";
}
}
+ // Only add the rest of the options if the temporary switch radio button is set
+ // and if the game launching radio button is set
else if (rb_launcher.Checked)
{
+ // TODO need to make this work so at least one game library is installed
+ // i.e. if (!SteamGame.SteamInstalled && !UplayGame.UplayInstalled )
if (!SteamGame.SteamInstalled)
{
throw new Exception(Language.Steam_is_not_installed);
}
- var steamGame = new SteamGame((uint) nud_appid.Value);
- args.Add($"-s {(int) nud_appid.Value}");
- args.Add($"-t {(int) nud_steamtimeout.Value}");
+ // TODO - Add in Uplay game as well depending on which one was requested
+ // Add the Steam Game ID to the shortcut arguments
+ var steamGame = new SteamGame((uint) nud_game_appid.Value);
+ args.Add($"--steam {(int) nud_game_appid.Value}");
+
+ // Add the game timeout argument and the timeout duration in seconds to the shortcut arguments
+ args.Add($"--timeout {(int) nud_timeout_game.Value}");
+
+ if (cb_args_game.Checked && !string.IsNullOrWhiteSpace(txt_args_game.Text))
+ {
+ args.Add($"--arguments \"{txt_args_game.Text.Trim()}\"");
+ }
+
+ // Prepare text for the shortcut description field
description = string.Format(Language.Executing_application_with_profile, steamGame.Name,
Profile.Name);
var steamIcon = steamGame.GetIcon().Result;
+ // Grab an icon for the selected game
if (!string.IsNullOrWhiteSpace(steamIcon))
{
try
@@ -280,15 +361,14 @@ namespace HeliosDisplayManagement.UIForms
}
}
- if (cb_args.Checked && !string.IsNullOrWhiteSpace(txt_args_executable.Text))
- {
- args.Add($"--arguments \"{txt_args_executable.Text.Trim()}\"");
- }
}
+ // Only add the rest of the options if the permanent switch radio button is set
else
{
+ // Prepare text for the shortcut description field
description = string.Format(Language.Switching_display_profile_to_profile, Profile.Name);
+ // Grab an icon for the selected profile
try
{
icon = Path.Combine(IconCache, Guid.NewGuid() + ".ico");
@@ -300,8 +380,14 @@ namespace HeliosDisplayManagement.UIForms
}
}
+ // TODO - Make this semi-automatic if its a game to be launched. Maybe still show
+ // a save prompt, but suggest the name of the game extracted from the game launcher
+ // or the executable itself.
+
+ // Now we are ready to create a shortcut based on the filename the user gave us
fileName = Path.ChangeExtension(fileName, @"lnk");
+ // If the user supplied a file
if (fileName != null)
{
try
@@ -312,6 +398,7 @@ namespace HeliosDisplayManagement.UIForms
File.Delete(fileName);
}
+ // Actually create the shortcut!
var wshShellType = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"));
dynamic wshShell = Activator.CreateInstance(wshShellType);
@@ -354,29 +441,42 @@ namespace HeliosDisplayManagement.UIForms
}
}
+ // Return a status on how it went
+ // true if it was a success or false if it was not
return fileName != null && File.Exists(fileName);
}
- private void nud_steamappid_ValueChanged(object sender, EventArgs e)
+ private void nud_game_appid_ValueChanged(object sender, EventArgs e)
{
- lbl_steamname.Text = new SteamGame((uint) nud_appid.Value).ToString();
+ //lbl_steamname.Text = new SteamGame((uint) nud_game_appid.Value).ToString();
}
- private void nud_steamapps_Click(object sender, EventArgs e)
+ /*private void nud_steamapps_Click(object sender, EventArgs e)
{
var steamGamesForm = new SteamGamesForm();
if (steamGamesForm.ShowDialog(this) == DialogResult.OK && steamGamesForm.SteamGame != null)
{
- nud_appid.Value = steamGamesForm.SteamGame.AppId;
+ nud_game_appid.Value = steamGamesForm.SteamGame.AppId;
+ }
+ }*/
+
+/* private void rb_wait_process_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_wait_process.Checked)
+ {
+ // Enable the Process Name Text field
+ txt_process_name.Enabled = true;
}
}
+*/
private void txt_executable_TextChanged(object sender, EventArgs e)
{
try
{
- txt_process.Text = Path.GetFileNameWithoutExtension(txt_executable.Text)?.ToLower() ?? txt_process.Text;
+ txt_process_name.Text = Path.GetFileNameWithoutExtension(txt_executable.Text)?.ToLower() ?? txt_process_name.Text;
+
}
catch
{
@@ -384,22 +484,37 @@ namespace HeliosDisplayManagement.UIForms
}
}
+ private void rb_switch_perm_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_switch_perm.Checked)
+ {
+ // Disable the Temporary Group
+ g_temporary.Enabled = false;
+ }
+
+ }
private void rb_switch_temp_CheckedChanged(object sender, EventArgs e)
{
- g_temp.Enabled = rb_switch_temp.Checked;
+ if (rb_switch_temp.Checked)
+ {
+ // Enable the Temporary Group
+ g_temporary.Enabled = true;
+ }
+
+ /*g_temporary.Enabled = rb_switch_temp.Checked;
p_standalone.Enabled = rb_standalone.Checked;
- txt_process.Enabled = cb_process.Checked;
+ txt_process_name.Enabled = cb_process.Checked;
nud_timeout.Enabled = cb_process.Checked;
- p_steam.Enabled = rb_launcher.Checked;
+ p_game.Enabled = rb_launcher.Checked;
txt_args_executable.Enabled = cb_args.Checked;
if (rb_launcher.Checked)
{
nud_steamappid_ValueChanged(rb_launcher, e);
- }
+ }*/
}
private void label1_Click(object sender, EventArgs e)
@@ -412,9 +527,150 @@ namespace HeliosDisplayManagement.UIForms
}
+ private void rb_standalone_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_standalone.Checked)
+ {
+ // Enable the Standalone Panel
+ p_standalone.Enabled = true;
+ // Disable the Game Panel
+ p_game.Enabled = false;
+ }
+ }
+
+ private void rb_launcher_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_launcher.Checked)
+ {
+ // Enable the Game Panel
+ p_game.Enabled = true;
+ // Disable the Standalone Panel
+ p_standalone.Enabled = false;
+ }
+ }
+
+
private void cb_args_executable_CheckedChanged(object sender, EventArgs e)
+ {
+ // Disable the Process Name Text field
+ if (cb_args_executable.Checked)
+ {
+ // Enable the Executable Arguments Text field
+ txt_args_executable.Enabled = true;
+ }
+ else
+ {
+ // Disable the Executable Arguments Text field
+ txt_args_executable.Enabled = false;
+ }
+
+ }
+
+ private void ShortcutForm_Load(object sender, EventArgs e)
+ {
+
+ // Make the game launcher selector read only.
+ cmb_game_launcher.DropDownStyle = ComboBoxStyle.DropDownList;
+ // Fill the list of supported game libraries
+ foreach (var gameLibirary in Enum.GetNames(typeof(SupportedGameLibrary))) {
+ cmb_game_launcher.Items.Add(gameLibirary);
+ }
+
+ // Start finding the games and loading the tree_games
+ /*foreach (var game in SteamGame.GetAllOwnedGames().OrderByDescending(game => game.IsInstalled).ThenBy(game => game.Name))
+ {
+ var iconAddress = await game.GetIcon();
+
+ if (!string.IsNullOrWhiteSpace(iconAddress))
+ {
+ try
+ {
+ using (var fileReader = File.OpenRead(iconAddress))
+ {
+ var icon = new Icon(fileReader, il_games.ImageSize);
+ il_games.Images.Add(icon);
+ }
+ }
+ catch
+ {
+ il_games.Images.Add(Properties.Resources.SteamIcon);
+ }
+ }
+ else
+ {
+ il_games.Images.Add(Properties.Resources.SteamIcon);
+ }
+
+ if (!Visible)
+ {
+ return;
+ }
+
+ lv_games.Items.Add(new ListViewItem
+ {
+ Text = game.Name,
+ Tag = game,
+ ImageIndex = il_games.Images.Count - 1
+ });
+ }*/
+ }
+
+ private void rb_wait_process_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_wait_process.Checked)
+ {
+ // Enable the Process Name Text field
+ txt_process_name.Enabled = true;
+ }
+ }
+
+ private void rb_wait_executable_CheckedChanged(object sender, EventArgs e)
+ {
+ if (rb_wait_executable.Checked)
+ {
+ // Disable the Process Name Text field
+ txt_process_name.Enabled = false;
+ }
+ }
+
+ private void nud_timeout_executable_ValueChanged(object sender, EventArgs e)
{
}
+
+ private void nud_timeout_game_ValueChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void txt_args_executable_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void txt_game_name_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void btn_app_process_Click(object sender, EventArgs e)
+ {
+ if (dialog_open.ShowDialog(this) == DialogResult.OK)
+ {
+ if (File.Exists(dialog_open.FileName) && Path.GetExtension(dialog_open.FileName) == @".exe")
+ {
+ txt_process_name.Text = dialog_open.FileName;
+ dialog_open.FileName = string.Empty;
+ }
+ else
+ {
+ MessageBox.Show(
+ Language.Selected_file_is_not_a_valid_executable_file,
+ Language.Executable,
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation);
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/HeliosDisplayManagement/UIForms/ShortcutForm.resx b/HeliosDisplayManagement/UIForms/ShortcutForm.resx
index 8a3aecd..19e5da7 100644
--- a/HeliosDisplayManagement/UIForms/ShortcutForm.resx
+++ b/HeliosDisplayManagement/UIForms/ShortcutForm.resx
@@ -123,6 +123,12 @@
258, 24
+
+ 373, 24
+
+
+ 72
+