[WIP] Working process priority UI

And also saving and loading. Now only implementation
to go.
This commit is contained in:
Terry MacDonald 2021-07-25 16:41:26 +12:00
parent ea6d6aa4c2
commit 28ec42b92d
6 changed files with 148 additions and 45 deletions

View File

@ -21,31 +21,31 @@ namespace DisplayMagician
{ {
public enum ShortcutPermanence : int public enum ShortcutPermanence : int
{ {
Permanent = 1, Permanent = 0,
Temporary = 2, Temporary = 1,
} }
public enum ShortcutCategory : int public enum ShortcutCategory : int
{ {
Application = 1, Application = 0,
Game = 2, Game = 1,
NoGame = 3, NoGame = 2,
} }
public enum ShortcutValidity : int public enum ShortcutValidity : int
{ {
Valid = 1, Valid = 0,
Warning = 2, Warning = 1,
Error =3, Error = 2,
} }
public enum ProcessPriority : int public enum ProcessPriority : int
{ {
High = 1, High = 2,
AboveNormal = 2, AboveNormal = 1,
Normal = 3, Normal = 0,
BelowNormal = 4, BelowNormal =-1,
Idle = 5, Idle = -24,
} }
@ -53,12 +53,12 @@ namespace DisplayMagician
{ {
public int Priority; public int Priority;
public bool Disabled; public bool Disabled;
public ProcessPriority ProcessPriority;
public string Executable; public string Executable;
public string Arguments; public string Arguments;
public bool ExecutableArgumentsRequired; public bool ExecutableArgumentsRequired;
public bool CloseOnFinish; public bool CloseOnFinish;
public bool DontStartIfAlreadyRunning; public bool DontStartIfAlreadyRunning;
public ProcessPriority ProcessPriority;
} }
public struct Executable public struct Executable
@ -1527,14 +1527,7 @@ namespace DisplayMagician
{ {
if (AutoName && _profileToUse is ProfileItem) if (AutoName && _profileToUse is ProfileItem)
{ {
if (Category.Equals(ShortcutCategory.NoGame)) if (Category.Equals(ShortcutCategory.Game) && GameName.Length > 0)
{
if (DisplayPermanence.Equals(ShortcutPermanence.Permanent))
_name = $"{_profileToUse.Name}";
else if (DisplayPermanence.Equals(ShortcutPermanence.Temporary))
_name = $"{_profileToUse.Name} (Temporary)";
}
else if (Category.Equals(ShortcutCategory.Game) && GameName.Length > 0)
{ {
_name = $"{GameName} ({_profileToUse.Name})"; _name = $"{GameName} ({_profileToUse.Name})";
} }
@ -1543,6 +1536,13 @@ namespace DisplayMagician
string baseName = Path.GetFileNameWithoutExtension(ExecutableNameAndPath); string baseName = Path.GetFileNameWithoutExtension(ExecutableNameAndPath);
_name = $"{baseName} ({_profileToUse.Name})"; _name = $"{baseName} ({_profileToUse.Name})";
} }
else
{
if (DisplayPermanence.Equals(ShortcutPermanence.Permanent))
_name = $"{_profileToUse.Name}";
else if (DisplayPermanence.Equals(ShortcutPermanence.Temporary))
_name = $"{_profileToUse.Name} (Temporary)";
}
} }
} }

View File

@ -388,7 +388,15 @@ namespace DisplayMagician
// Replace any "Enabled": true with "Disabled": false // Replace any "Enabled": true with "Disabled": false
json = Regex.Replace(json, @" ""Enabled"": true,", @" ""Disabled"": false,"); json = Regex.Replace(json, @" ""Enabled"": true,", @" ""Disabled"": false,");
// Replace any "Enabled": false with "Disabled": true // Replace any "Enabled": false with "Disabled": true
json = Regex.Replace(json, @" ""Enabled"": false,", @" ""Disabled"": true,"); json = Regex.Replace(json, @" ""Enabled"": false,", @" ""Disabled"": true,");
// If the shortcuts file doesn't have "ProcessPriority" in it, then we need to add it
if (!Regex.Match(json, @"""ProcessPriority""").Success)
{
// Add the ProcessPriority line as null so its in there at least and won't stop the json load
json = Regex.Replace(json, " \"DifferentExecutableToMonitor\"", " \"ProcessPriority\": null,\n \"DifferentExecutableToMonitor\"");
}
} }
catch(Exception ex) catch(Exception ex)
{ {
@ -411,7 +419,8 @@ namespace DisplayMagician
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.Error(ex, $"ShortcutRepository/LoadShortcuts: Tried to parse the JSON in the {_shortcutStorageJsonFileName} but the JsonConvert threw an exception."); logger.Error(ex, $"ShortcutRepository/LoadShortcuts: Tried to parse the JSON in the {_shortcutStorageJsonFileName} but the JsonConvert threw an exception. There is an error in the SHortcut JSON file!");
throw new Exception("ShortcutRepository/LoadShortcuts: Tried to parse the JSON in the {_shortcutStorageJsonFileName} but the JsonConvert threw an exception. There is an error in the SHortcut JSON file!");
} }
// Lookup all the Profile Names in the Saved Profiles // Lookup all the Profile Names in the Saved Profiles

View File

@ -117,6 +117,8 @@ namespace DisplayMagician.UIForms
this.cb_autosuggest = new System.Windows.Forms.CheckBox(); this.cb_autosuggest = new System.Windows.Forms.CheckBox();
this.btn_hotkey = new System.Windows.Forms.Button(); this.btn_hotkey = new System.Windows.Forms.Button();
this.lbl_hotkey_assigned = new System.Windows.Forms.Label(); this.lbl_hotkey_assigned = new System.Windows.Forms.Label();
this.cbx_exe_priority = new System.Windows.Forms.ComboBox();
this.lbl_exe_priority = new System.Windows.Forms.Label();
this.tabc_shortcut.SuspendLayout(); this.tabc_shortcut.SuspendLayout();
this.tabp_display.SuspendLayout(); this.tabp_display.SuspendLayout();
this.tabp_audio.SuspendLayout(); this.tabp_audio.SuspendLayout();
@ -720,6 +722,8 @@ namespace DisplayMagician.UIForms
// //
// p_standalone // p_standalone
// //
this.p_standalone.Controls.Add(this.cbx_exe_priority);
this.p_standalone.Controls.Add(this.lbl_exe_priority);
this.p_standalone.Controls.Add(this.btn_exe_to_start); this.p_standalone.Controls.Add(this.btn_exe_to_start);
this.p_standalone.Controls.Add(this.txt_args_executable); this.p_standalone.Controls.Add(this.txt_args_executable);
this.p_standalone.Controls.Add(this.cb_args_executable); this.p_standalone.Controls.Add(this.cb_args_executable);
@ -775,7 +779,7 @@ namespace DisplayMagician.UIForms
// //
this.btn_choose_alternative_executable.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_choose_alternative_executable.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_choose_alternative_executable.ForeColor = System.Drawing.Color.White; this.btn_choose_alternative_executable.ForeColor = System.Drawing.Color.White;
this.btn_choose_alternative_executable.Location = new System.Drawing.Point(877, 115); this.btn_choose_alternative_executable.Location = new System.Drawing.Point(880, 121);
this.btn_choose_alternative_executable.Name = "btn_choose_alternative_executable"; this.btn_choose_alternative_executable.Name = "btn_choose_alternative_executable";
this.btn_choose_alternative_executable.Size = new System.Drawing.Size(85, 27); this.btn_choose_alternative_executable.Size = new System.Drawing.Size(85, 27);
this.btn_choose_alternative_executable.TabIndex = 9; this.btn_choose_alternative_executable.TabIndex = 9;
@ -786,7 +790,7 @@ namespace DisplayMagician.UIForms
// txt_alternative_executable // txt_alternative_executable
// //
this.txt_alternative_executable.Enabled = false; this.txt_alternative_executable.Enabled = false;
this.txt_alternative_executable.Location = new System.Drawing.Point(493, 116); this.txt_alternative_executable.Location = new System.Drawing.Point(496, 122);
this.txt_alternative_executable.Name = "txt_alternative_executable"; this.txt_alternative_executable.Name = "txt_alternative_executable";
this.txt_alternative_executable.Size = new System.Drawing.Size(378, 26); this.txt_alternative_executable.Size = new System.Drawing.Size(378, 26);
this.txt_alternative_executable.TabIndex = 4; this.txt_alternative_executable.TabIndex = 4;
@ -796,7 +800,7 @@ namespace DisplayMagician.UIForms
// //
this.rb_wait_alternative_executable.AutoSize = true; this.rb_wait_alternative_executable.AutoSize = true;
this.rb_wait_alternative_executable.ForeColor = System.Drawing.Color.White; this.rb_wait_alternative_executable.ForeColor = System.Drawing.Color.White;
this.rb_wait_alternative_executable.Location = new System.Drawing.Point(23, 118); this.rb_wait_alternative_executable.Location = new System.Drawing.Point(23, 122);
this.rb_wait_alternative_executable.Name = "rb_wait_alternative_executable"; this.rb_wait_alternative_executable.Name = "rb_wait_alternative_executable";
this.rb_wait_alternative_executable.Size = new System.Drawing.Size(468, 24); this.rb_wait_alternative_executable.Size = new System.Drawing.Size(468, 24);
this.rb_wait_alternative_executable.TabIndex = 8; this.rb_wait_alternative_executable.TabIndex = 8;
@ -810,7 +814,7 @@ namespace DisplayMagician.UIForms
this.rb_wait_executable.AutoSize = true; this.rb_wait_executable.AutoSize = true;
this.rb_wait_executable.Checked = true; this.rb_wait_executable.Checked = true;
this.rb_wait_executable.ForeColor = System.Drawing.Color.White; this.rb_wait_executable.ForeColor = System.Drawing.Color.White;
this.rb_wait_executable.Location = new System.Drawing.Point(23, 87); this.rb_wait_executable.Location = new System.Drawing.Point(23, 83);
this.rb_wait_executable.Name = "rb_wait_executable"; this.rb_wait_executable.Name = "rb_wait_executable";
this.rb_wait_executable.Size = new System.Drawing.Size(439, 24); this.rb_wait_executable.Size = new System.Drawing.Size(439, 24);
this.rb_wait_executable.TabIndex = 7; this.rb_wait_executable.TabIndex = 7;
@ -1280,6 +1284,26 @@ namespace DisplayMagician.UIForms
this.lbl_hotkey_assigned.Visible = false; this.lbl_hotkey_assigned.Visible = false;
this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click); this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click);
// //
// cbx_exe_priority
//
this.cbx_exe_priority.AllowDrop = true;
this.cbx_exe_priority.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbx_exe_priority.FormattingEnabled = true;
this.cbx_exe_priority.Location = new System.Drawing.Point(786, 83);
this.cbx_exe_priority.Name = "cbx_exe_priority";
this.cbx_exe_priority.Size = new System.Drawing.Size(179, 28);
this.cbx_exe_priority.TabIndex = 31;
//
// lbl_exe_priority
//
this.lbl_exe_priority.AutoSize = true;
this.lbl_exe_priority.ForeColor = System.Drawing.Color.White;
this.lbl_exe_priority.Location = new System.Drawing.Point(642, 86);
this.lbl_exe_priority.Name = "lbl_exe_priority";
this.lbl_exe_priority.Size = new System.Drawing.Size(143, 20);
this.lbl_exe_priority.TabIndex = 30;
this.lbl_exe_priority.Text = "Executable Priority:";
//
// ShortcutForm // ShortcutForm
// //
this.AcceptButton = this.btn_save; this.AcceptButton = this.btn_save;
@ -1429,5 +1453,7 @@ namespace DisplayMagician.UIForms
internal Manina.Windows.Forms.ImageListView ilv_games; internal Manina.Windows.Forms.ImageListView ilv_games;
private System.Windows.Forms.Button btn_find_examples; private System.Windows.Forms.Button btn_find_examples;
private System.Windows.Forms.ComboBox cbx_game_priority; private System.Windows.Forms.ComboBox cbx_game_priority;
private System.Windows.Forms.ComboBox cbx_exe_priority;
private System.Windows.Forms.Label lbl_exe_priority;
} }
} }

View File

@ -495,14 +495,15 @@ namespace DisplayMagician.UIForms
if (rb_launcher.Checked) if (rb_launcher.Checked)
{ {
logger.Trace($"ShortcutForm/btn_save_Click: We're saving a game!"); logger.Trace($"ShortcutForm/btn_save_Click: We're saving a game!");
_gameToUse = new GameStruct _gameToUse = new GameStruct
{ {
StartTimeout = Convert.ToInt32(nud_timeout_game.Value), StartTimeout = Convert.ToInt32(nud_timeout_game.Value),
GameArguments = txt_args_game.Text, GameArguments = txt_args_game.Text,
GameArgumentsRequired = cb_args_game.Checked, GameArgumentsRequired = cb_args_game.Checked,
DifferentGameExeToMonitor = txt_alternative_game.Text, DifferentGameExeToMonitor = txt_alternative_game.Text,
MonitorDifferentGameExe = cb_wait_alternative_game.Checked MonitorDifferentGameExe = cb_wait_alternative_game.Checked,
ProcessPriority = (ProcessPriority)cbx_game_priority.SelectedValue,
}; };
// If the game is a SteamGame // If the game is a SteamGame
@ -597,7 +598,8 @@ namespace DisplayMagician.UIForms
ExecutableArguments = txt_args_executable.Text, ExecutableArguments = txt_args_executable.Text,
ExecutableArgumentsRequired = cb_args_executable.Checked, ExecutableArgumentsRequired = cb_args_executable.Checked,
ExecutableNameAndPath = txt_executable.Text, ExecutableNameAndPath = txt_executable.Text,
ExecutableTimeout = Convert.ToInt32(nud_timeout_executable.Value) ExecutableTimeout = Convert.ToInt32(nud_timeout_executable.Value),
ProcessPriority = (ProcessPriority)cbx_exe_priority.SelectedValue,
}; };
if (rb_wait_alternative_executable.Checked && !String.IsNullOrWhiteSpace(txt_alternative_executable.Text)) if (rb_wait_alternative_executable.Checked && !String.IsNullOrWhiteSpace(txt_alternative_executable.Text))
@ -822,19 +824,32 @@ namespace DisplayMagician.UIForms
bool foundChosenProfileInLoadedProfiles = false; bool foundChosenProfileInLoadedProfiles = false;
ProfileItem chosenProfile = null; ProfileItem chosenProfile = null;
// Prepare the process priority combo box // Prepare the Game process priority combo box
cbx_game_priority.DataSource = new ComboItem[] { cbx_game_priority.DataSource = new ComboItem[] {
new ComboItem{ ID = 1, Text = "High" }, new ComboItem{ Value = ProcessPriority.High, Text = "High" },
new ComboItem{ ID = 2, Text = "Above Normal" }, new ComboItem{ Value = ProcessPriority.AboveNormal, Text = "Above Normal" },
new ComboItem{ ID = 3, Text = "Normal" }, new ComboItem{ Value = ProcessPriority.Normal, Text = "Normal" },
new ComboItem{ ID = 4, Text = "Below Normal" }, new ComboItem{ Value = ProcessPriority.BelowNormal, Text = "Below Normal" },
new ComboItem{ ID = 5, Text = "Idle" }, new ComboItem{ Value = ProcessPriority.Idle, Text = "Idle" },
}; };
cbx_game_priority.ValueMember = "Text"; cbx_game_priority.ValueMember = "Value";
cbx_game_priority.DisplayMember = "Text"; cbx_game_priority.DisplayMember = "Text";
cbx_game_priority.SelectedItem = "Normal"; cbx_game_priority.SelectedItem = "Normal";
cbx_game_priority.Enabled = true; cbx_game_priority.Enabled = true;
// Prepare the exe process priority combo box
cbx_exe_priority.DataSource = new ComboItem[] {
new ComboItem{ Value = ProcessPriority.High, Text = "High" },
new ComboItem{ Value = ProcessPriority.AboveNormal, Text = "Above Normal" },
new ComboItem{ Value = ProcessPriority.Normal, Text = "Normal" },
new ComboItem{ Value = ProcessPriority.BelowNormal, Text = "Below Normal" },
new ComboItem{ Value = ProcessPriority.Idle, Text = "Idle" },
};
cbx_exe_priority.ValueMember = "Value";
cbx_exe_priority.DisplayMember = "Text";
cbx_exe_priority.SelectedItem = "Normal";
cbx_exe_priority.Enabled = true;
// Populate all the Audio devices in the audio devices list. // Populate all the Audio devices in the audio devices list.
// Set the Audio device to the shortcut audio device only if // Set the Audio device to the shortcut audio device only if
// the Change Audio radiobutton is set // the Change Audio radiobutton is set
@ -1186,6 +1201,7 @@ namespace DisplayMagician.UIForms
_gameId = _shortcutToEdit.GameAppId; _gameId = _shortcutToEdit.GameAppId;
nud_timeout_game.Value = _shortcutToEdit.StartTimeout; nud_timeout_game.Value = _shortcutToEdit.StartTimeout;
txt_args_game.Text = _shortcutToEdit.GameArguments; txt_args_game.Text = _shortcutToEdit.GameArguments;
cbx_game_priority.SelectedItem = _shortcutToEdit.ProcessPriority;
if (_shortcutToEdit.GameArgumentsRequired) if (_shortcutToEdit.GameArgumentsRequired)
{ {
cb_args_game.Checked = true; cb_args_game.Checked = true;
@ -1198,6 +1214,7 @@ namespace DisplayMagician.UIForms
txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath; txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath;
nud_timeout_executable.Value = _shortcutToEdit.StartTimeout; nud_timeout_executable.Value = _shortcutToEdit.StartTimeout;
txt_args_executable.Text = _shortcutToEdit.ExecutableArguments; txt_args_executable.Text = _shortcutToEdit.ExecutableArguments;
cbx_exe_priority.SelectedItem = _shortcutToEdit.ProcessPriority;
if (_shortcutToEdit.ExecutableArgumentsRequired) if (_shortcutToEdit.ExecutableArgumentsRequired)
{ {
cb_args_executable.Checked = true; cb_args_executable.Checked = true;
@ -2297,7 +2314,7 @@ namespace DisplayMagician.UIForms
// Class used to populate combo boxes // Class used to populate combo boxes
class ComboItem class ComboItem
{ {
public int ID { get; set; } public ProcessPriority Value { get; set; }
public string Text { get; set; } public string Text { get; set; }
} }
} }

View File

@ -41,6 +41,8 @@ namespace DisplayMagician.UIForms
this.lbl_priority = new System.Windows.Forms.Label(); this.lbl_priority = new System.Windows.Forms.Label();
this.pb_up_arrow = new System.Windows.Forms.PictureBox(); this.pb_up_arrow = new System.Windows.Forms.PictureBox();
this.pb_down_arrow = new System.Windows.Forms.PictureBox(); this.pb_down_arrow = new System.Windows.Forms.PictureBox();
this.cbx_start_program_priority = new System.Windows.Forms.ComboBox();
this.lbl_start_program_priority = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pb_up_arrow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pb_up_arrow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pb_down_arrow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pb_down_arrow)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -50,7 +52,7 @@ namespace DisplayMagician.UIForms
this.cb_dont_start_if_running.AutoSize = true; this.cb_dont_start_if_running.AutoSize = true;
this.cb_dont_start_if_running.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cb_dont_start_if_running.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_dont_start_if_running.ForeColor = System.Drawing.Color.White; this.cb_dont_start_if_running.ForeColor = System.Drawing.Color.White;
this.cb_dont_start_if_running.Location = new System.Drawing.Point(160, 86); this.cb_dont_start_if_running.Location = new System.Drawing.Point(160, 83);
this.cb_dont_start_if_running.Name = "cb_dont_start_if_running"; this.cb_dont_start_if_running.Name = "cb_dont_start_if_running";
this.cb_dont_start_if_running.Size = new System.Drawing.Size(289, 24); this.cb_dont_start_if_running.Size = new System.Drawing.Size(289, 24);
this.cb_dont_start_if_running.TabIndex = 26; this.cb_dont_start_if_running.TabIndex = 26;
@ -77,7 +79,7 @@ namespace DisplayMagician.UIForms
this.cb_start_program_close.CheckState = System.Windows.Forms.CheckState.Checked; this.cb_start_program_close.CheckState = System.Windows.Forms.CheckState.Checked;
this.cb_start_program_close.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cb_start_program_close.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_start_program_close.ForeColor = System.Drawing.Color.White; this.cb_start_program_close.ForeColor = System.Drawing.Color.White;
this.cb_start_program_close.Location = new System.Drawing.Point(506, 86); this.cb_start_program_close.Location = new System.Drawing.Point(506, 115);
this.cb_start_program_close.Name = "cb_start_program_close"; this.cb_start_program_close.Name = "cb_start_program_close";
this.cb_start_program_close.Size = new System.Drawing.Size(458, 24); this.cb_start_program_close.Size = new System.Drawing.Size(458, 24);
this.cb_start_program_close.TabIndex = 24; this.cb_start_program_close.TabIndex = 24;
@ -104,7 +106,7 @@ namespace DisplayMagician.UIForms
this.txt_start_program_args.BackColor = System.Drawing.Color.White; this.txt_start_program_args.BackColor = System.Drawing.Color.White;
this.txt_start_program_args.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_start_program_args.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txt_start_program_args.ForeColor = System.Drawing.Color.Black; this.txt_start_program_args.ForeColor = System.Drawing.Color.Black;
this.txt_start_program_args.Location = new System.Drawing.Point(398, 56); this.txt_start_program_args.Location = new System.Drawing.Point(398, 50);
this.txt_start_program_args.Name = "txt_start_program_args"; this.txt_start_program_args.Name = "txt_start_program_args";
this.txt_start_program_args.Size = new System.Drawing.Size(506, 26); this.txt_start_program_args.Size = new System.Drawing.Size(506, 26);
this.txt_start_program_args.TabIndex = 22; this.txt_start_program_args.TabIndex = 22;
@ -115,7 +117,7 @@ namespace DisplayMagician.UIForms
this.cb_start_program_pass_args.AutoSize = true; this.cb_start_program_pass_args.AutoSize = true;
this.cb_start_program_pass_args.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cb_start_program_pass_args.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_start_program_pass_args.ForeColor = System.Drawing.Color.White; this.cb_start_program_pass_args.ForeColor = System.Drawing.Color.White;
this.cb_start_program_pass_args.Location = new System.Drawing.Point(160, 56); this.cb_start_program_pass_args.Location = new System.Drawing.Point(160, 50);
this.cb_start_program_pass_args.Name = "cb_start_program_pass_args"; this.cb_start_program_pass_args.Name = "cb_start_program_pass_args";
this.cb_start_program_pass_args.Size = new System.Drawing.Size(228, 24); this.cb_start_program_pass_args.Size = new System.Drawing.Size(228, 24);
this.cb_start_program_pass_args.TabIndex = 21; this.cb_start_program_pass_args.TabIndex = 21;
@ -143,7 +145,7 @@ namespace DisplayMagician.UIForms
this.cb_disable_start_program.AutoSize = true; this.cb_disable_start_program.AutoSize = true;
this.cb_disable_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cb_disable_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_disable_start_program.ForeColor = System.Drawing.Color.White; this.cb_disable_start_program.ForeColor = System.Drawing.Color.White;
this.cb_disable_start_program.Location = new System.Drawing.Point(160, 114); this.cb_disable_start_program.Location = new System.Drawing.Point(159, 115);
this.cb_disable_start_program.Name = "cb_disable_start_program"; this.cb_disable_start_program.Name = "cb_disable_start_program";
this.cb_disable_start_program.Size = new System.Drawing.Size(312, 24); this.cb_disable_start_program.Size = new System.Drawing.Size(312, 24);
this.cb_disable_start_program.TabIndex = 28; this.cb_disable_start_program.TabIndex = 28;
@ -198,12 +200,37 @@ namespace DisplayMagician.UIForms
this.pb_down_arrow.MouseEnter += new System.EventHandler(this.pb_down_arrow_MouseEnter); this.pb_down_arrow.MouseEnter += new System.EventHandler(this.pb_down_arrow_MouseEnter);
this.pb_down_arrow.MouseLeave += new System.EventHandler(this.pb_down_arrow_MouseLeave); this.pb_down_arrow.MouseLeave += new System.EventHandler(this.pb_down_arrow_MouseLeave);
// //
// cbx_start_program_priority
//
this.cbx_start_program_priority.AllowDrop = true;
this.cbx_start_program_priority.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbx_start_program_priority.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbx_start_program_priority.FormattingEnabled = true;
this.cbx_start_program_priority.Location = new System.Drawing.Point(725, 84);
this.cbx_start_program_priority.Name = "cbx_start_program_priority";
this.cbx_start_program_priority.Size = new System.Drawing.Size(179, 28);
this.cbx_start_program_priority.TabIndex = 34;
this.cbx_start_program_priority.SelectedIndexChanged += new System.EventHandler(this.cbx_start_program_priority_SelectedIndexChanged);
//
// lbl_start_program_priority
//
this.lbl_start_program_priority.AutoSize = true;
this.lbl_start_program_priority.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_start_program_priority.ForeColor = System.Drawing.Color.White;
this.lbl_start_program_priority.Location = new System.Drawing.Point(563, 87);
this.lbl_start_program_priority.Name = "lbl_start_program_priority";
this.lbl_start_program_priority.Size = new System.Drawing.Size(163, 20);
this.lbl_start_program_priority.TabIndex = 33;
this.lbl_start_program_priority.Text = "Start Program Priority:";
//
// StartProgramControl // StartProgramControl
// //
this.AllowDrop = true; this.AllowDrop = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.AutoSize = true; this.AutoSize = true;
this.BackColor = System.Drawing.Color.Black; this.BackColor = System.Drawing.Color.Black;
this.Controls.Add(this.cbx_start_program_priority);
this.Controls.Add(this.lbl_start_program_priority);
this.Controls.Add(this.pb_up_arrow); this.Controls.Add(this.pb_up_arrow);
this.Controls.Add(this.pb_down_arrow); this.Controls.Add(this.pb_down_arrow);
this.Controls.Add(this.lbl_priority); this.Controls.Add(this.lbl_priority);
@ -241,5 +268,7 @@ namespace DisplayMagician.UIForms
private System.Windows.Forms.Label lbl_priority; private System.Windows.Forms.Label lbl_priority;
private System.Windows.Forms.PictureBox pb_down_arrow; private System.Windows.Forms.PictureBox pb_down_arrow;
private System.Windows.Forms.PictureBox pb_up_arrow; private System.Windows.Forms.PictureBox pb_up_arrow;
private System.Windows.Forms.ComboBox cbx_start_program_priority;
private System.Windows.Forms.Label lbl_start_program_priority;
} }
} }

View File

@ -50,6 +50,20 @@ namespace DisplayMagician.UIForms
// Update the text with the start program info // Update the text with the start program info
myStartProgram = startProgram; myStartProgram = startProgram;
myStartProgram.Priority = startProgramOrder; myStartProgram.Priority = startProgramOrder;
// Prepare the start program process priority combo box
cbx_start_program_priority.DataSource = new ComboItem[] {
new ComboItem{ Value = ProcessPriority.High, Text = "High" },
new ComboItem{ Value = ProcessPriority.AboveNormal, Text = "Above Normal" },
new ComboItem{ Value = ProcessPriority.Normal, Text = "Normal" },
new ComboItem{ Value = ProcessPriority.BelowNormal, Text = "Below Normal" },
new ComboItem{ Value = ProcessPriority.Idle, Text = "Idle" },
};
cbx_start_program_priority.ValueMember = "Value";
cbx_start_program_priority.DisplayMember = "Text";
cbx_start_program_priority.SelectedItem = "Normal";
cbx_start_program_priority.Enabled = true;
UpdateUI(); UpdateUI();
} }
@ -63,6 +77,7 @@ namespace DisplayMagician.UIForms
txt_start_program_args.Text = myStartProgram.Arguments; txt_start_program_args.Text = myStartProgram.Arguments;
cb_start_program_close.Checked = myStartProgram.CloseOnFinish; cb_start_program_close.Checked = myStartProgram.CloseOnFinish;
cb_dont_start_if_running.Checked = myStartProgram.DontStartIfAlreadyRunning; cb_dont_start_if_running.Checked = myStartProgram.DontStartIfAlreadyRunning;
cbx_start_program_priority.SelectedValue = myStartProgram.ProcessPriority;
} }
@ -92,6 +107,7 @@ namespace DisplayMagician.UIForms
cb_start_program_pass_args.Enabled = false; cb_start_program_pass_args.Enabled = false;
cb_start_program_close.Enabled = false; cb_start_program_close.Enabled = false;
cb_dont_start_if_running.Enabled = false; cb_dont_start_if_running.Enabled = false;
cbx_start_program_priority.Enabled = false;
} }
else else
{ {
@ -103,6 +119,7 @@ namespace DisplayMagician.UIForms
cb_start_program_pass_args.Enabled = true; cb_start_program_pass_args.Enabled = true;
cb_start_program_close.Enabled = true; cb_start_program_close.Enabled = true;
cb_dont_start_if_running.Enabled = true; cb_dont_start_if_running.Enabled = true;
cbx_start_program_priority.Enabled = true;
} }
} }
@ -215,5 +232,10 @@ namespace DisplayMagician.UIForms
{ {
myStartProgram.Arguments = txt_start_program_args.Text; myStartProgram.Arguments = txt_start_program_args.Text;
} }
private void cbx_start_program_priority_SelectedIndexChanged(object sender, EventArgs e)
{
myStartProgram.ProcessPriority = (ProcessPriority)cbx_start_program_priority.SelectedValue;
}
} }
} }