From 1d752a10210245204c942376613fd00bb5b549e8 Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Sat, 8 May 2021 22:59:38 +1200 Subject: [PATCH] [WIP] First StartProgram UserControl First attempt at using a customer User Control to make it easier to create dynamic list of start programs to kick off before the main program is started. I already have the ability within the data model to store and track multiple start programs... the difficulty is in making the WninForms UI handle a dynamic number of start programs. This is the basic construction of it, but it needs a LOT of UI work. --- DisplayMagician/DisplayMagician.csproj | 9 + .../UIForms/ShortcutForm.Designer.cs | 510 +----------------- DisplayMagician/UIForms/ShortcutForm.cs | 253 +-------- .../UIForms/StartProgramControl.Designer.cs | 182 +++++++ .../UIForms/StartProgramControl.cs | 125 +++++ .../UIForms/StartProgramControl.resx | 120 +++++ .../DisplayMagicianFilesFragment.wxs | 12 +- 7 files changed, 480 insertions(+), 731 deletions(-) create mode 100644 DisplayMagician/UIForms/StartProgramControl.Designer.cs create mode 100644 DisplayMagician/UIForms/StartProgramControl.cs create mode 100644 DisplayMagician/UIForms/StartProgramControl.resx diff --git a/DisplayMagician/DisplayMagician.csproj b/DisplayMagician/DisplayMagician.csproj index 821dcb2..16ba568 100644 --- a/DisplayMagician/DisplayMagician.csproj +++ b/DisplayMagician/DisplayMagician.csproj @@ -166,6 +166,12 @@ ShortcutLibraryForm.cs + + UserControl + + + StartProgramControl.cs + @@ -230,6 +236,9 @@ ShortcutLibraryForm.cs Designer + + StartProgramControl.cs + diff --git a/DisplayMagician/UIForms/ShortcutForm.Designer.cs b/DisplayMagician/UIForms/ShortcutForm.Designer.cs index 08104f1..237cca5 100644 --- a/DisplayMagician/UIForms/ShortcutForm.Designer.cs +++ b/DisplayMagician/UIForms/ShortcutForm.Designer.cs @@ -68,42 +68,7 @@ namespace DisplayMagician.UIForms this.rb_change_audio = new System.Windows.Forms.RadioButton(); this.rb_no_change_audio = new System.Windows.Forms.RadioButton(); this.tabp_before = new System.Windows.Forms.TabPage(); - this.pnl_start_program4 = new System.Windows.Forms.Panel(); - this.cb_dont_start_if_running4 = new System.Windows.Forms.CheckBox(); - this.cb_start_program4 = new System.Windows.Forms.CheckBox(); - this.txt_start_program4 = new System.Windows.Forms.TextBox(); - this.cb_start_program_close4 = new System.Windows.Forms.CheckBox(); - this.btn_start_program4 = new System.Windows.Forms.Button(); - this.txt_start_program_args4 = new System.Windows.Forms.TextBox(); - this.cb_start_program_pass_args4 = new System.Windows.Forms.CheckBox(); - this.lbl_start_program4 = new System.Windows.Forms.Label(); - this.pnl_start_program3 = new System.Windows.Forms.Panel(); - this.cb_dont_start_if_running3 = new System.Windows.Forms.CheckBox(); - this.cb_start_program3 = new System.Windows.Forms.CheckBox(); - this.txt_start_program3 = new System.Windows.Forms.TextBox(); - this.cb_start_program_close3 = new System.Windows.Forms.CheckBox(); - this.btn_start_program3 = new System.Windows.Forms.Button(); - this.txt_start_program_args3 = new System.Windows.Forms.TextBox(); - this.cb_start_program_pass_args3 = new System.Windows.Forms.CheckBox(); - this.lbl_start_program3 = new System.Windows.Forms.Label(); - this.pnl_start_program2 = new System.Windows.Forms.Panel(); - this.cb_dont_start_if_running2 = new System.Windows.Forms.CheckBox(); - this.cb_start_program2 = new System.Windows.Forms.CheckBox(); - this.txt_start_program2 = new System.Windows.Forms.TextBox(); - this.cb_start_program_close2 = new System.Windows.Forms.CheckBox(); - this.btn_start_program2 = new System.Windows.Forms.Button(); - this.txt_start_program_args2 = new System.Windows.Forms.TextBox(); - this.cb_start_program_pass_args2 = new System.Windows.Forms.CheckBox(); - this.lbl_start_program2 = new System.Windows.Forms.Label(); - this.pnl_start_program1 = new System.Windows.Forms.Panel(); - this.cb_dont_start_if_running1 = new System.Windows.Forms.CheckBox(); - this.cb_start_program1 = new System.Windows.Forms.CheckBox(); - this.txt_start_program1 = new System.Windows.Forms.TextBox(); - this.cb_start_program_close1 = new System.Windows.Forms.CheckBox(); - this.btn_start_program1 = new System.Windows.Forms.Button(); - this.txt_start_program_args1 = new System.Windows.Forms.TextBox(); - this.cb_start_program_pass_args1 = new System.Windows.Forms.CheckBox(); - this.lbl_start_program1 = new System.Windows.Forms.Label(); + this.pnl_start_programs = new System.Windows.Forms.Panel(); this.tabp_game = new System.Windows.Forms.TabPage(); this.lbl_no_game_libraries = new System.Windows.Forms.Label(); this.p_standalone = new System.Windows.Forms.Panel(); @@ -164,10 +129,6 @@ namespace DisplayMagician.UIForms this.gb_audio_volume.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).BeginInit(); this.tabp_before.SuspendLayout(); - this.pnl_start_program4.SuspendLayout(); - this.pnl_start_program3.SuspendLayout(); - this.pnl_start_program2.SuspendLayout(); - this.pnl_start_program1.SuspendLayout(); this.tabp_game.SuspendLayout(); this.p_standalone.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_executable)).BeginInit(); @@ -655,10 +616,7 @@ namespace DisplayMagician.UIForms // tabp_before // this.tabp_before.BackColor = System.Drawing.Color.Black; - this.tabp_before.Controls.Add(this.pnl_start_program4); - this.tabp_before.Controls.Add(this.pnl_start_program3); - this.tabp_before.Controls.Add(this.pnl_start_program2); - this.tabp_before.Controls.Add(this.pnl_start_program1); + this.tabp_before.Controls.Add(this.pnl_start_programs); this.tabp_before.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabp_before.ForeColor = System.Drawing.Color.White; this.tabp_before.Location = new System.Drawing.Point(4, 32); @@ -668,417 +626,14 @@ namespace DisplayMagician.UIForms this.tabp_before.TabIndex = 1; this.tabp_before.Text = "3. Choose what happens before"; // - // pnl_start_program4 - // - this.pnl_start_program4.Controls.Add(this.cb_dont_start_if_running4); - this.pnl_start_program4.Controls.Add(this.cb_start_program4); - this.pnl_start_program4.Controls.Add(this.txt_start_program4); - this.pnl_start_program4.Controls.Add(this.cb_start_program_close4); - this.pnl_start_program4.Controls.Add(this.btn_start_program4); - this.pnl_start_program4.Controls.Add(this.txt_start_program_args4); - this.pnl_start_program4.Controls.Add(this.cb_start_program_pass_args4); - this.pnl_start_program4.Controls.Add(this.lbl_start_program4); - this.pnl_start_program4.Location = new System.Drawing.Point(48, 443); - this.pnl_start_program4.Name = "pnl_start_program4"; - this.pnl_start_program4.Size = new System.Drawing.Size(959, 124); - this.pnl_start_program4.TabIndex = 19; - // - // cb_dont_start_if_running4 - // - this.cb_dont_start_if_running4.AutoSize = true; - this.cb_dont_start_if_running4.ForeColor = System.Drawing.Color.White; - this.cb_dont_start_if_running4.Location = new System.Drawing.Point(167, 82); - this.cb_dont_start_if_running4.Name = "cb_dont_start_if_running4"; - this.cb_dont_start_if_running4.Size = new System.Drawing.Size(289, 24); - this.cb_dont_start_if_running4.TabIndex = 20; - this.cb_dont_start_if_running4.Text = "Don\'t start if program already running"; - this.cb_dont_start_if_running4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_dont_start_if_running4.UseVisualStyleBackColor = true; - this.cb_dont_start_if_running4.Visible = false; - // - // cb_start_program4 - // - this.cb_start_program4.Location = new System.Drawing.Point(21, 18); - this.cb_start_program4.Name = "cb_start_program4"; - this.cb_start_program4.Size = new System.Drawing.Size(15, 14); - this.cb_start_program4.TabIndex = 18; - this.cb_start_program4.UseVisualStyleBackColor = true; - this.cb_start_program4.CheckedChanged += new System.EventHandler(this.cb_start_program4_CheckedChanged); - // - // txt_start_program4 - // - this.txt_start_program4.Location = new System.Drawing.Point(300, 11); - this.txt_start_program4.Name = "txt_start_program4"; - this.txt_start_program4.Size = new System.Drawing.Size(535, 26); - this.txt_start_program4.TabIndex = 17; - this.txt_start_program4.Visible = false; - // - // cb_start_program_close4 - // - this.cb_start_program_close4.AutoSize = true; - this.cb_start_program_close4.ForeColor = System.Drawing.Color.White; - this.cb_start_program_close4.Location = new System.Drawing.Point(547, 82); - this.cb_start_program_close4.Name = "cb_start_program_close4"; - this.cb_start_program_close4.Size = new System.Drawing.Size(398, 24); - this.cb_start_program_close4.TabIndex = 16; - this.cb_start_program_close4.Text = "Close started program when you finish playing Game"; - this.cb_start_program_close4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_close4.UseVisualStyleBackColor = true; - this.cb_start_program_close4.Visible = false; - // - // btn_start_program4 - // - this.btn_start_program4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btn_start_program4.ForeColor = System.Drawing.Color.White; - this.btn_start_program4.Location = new System.Drawing.Point(851, 10); - this.btn_start_program4.Name = "btn_start_program4"; - this.btn_start_program4.Size = new System.Drawing.Size(85, 27); - this.btn_start_program4.TabIndex = 15; - this.btn_start_program4.Text = "Choose"; - this.btn_start_program4.UseVisualStyleBackColor = true; - this.btn_start_program4.Visible = false; - this.btn_start_program4.Click += new System.EventHandler(this.btn_start_program4_Click); - // - // txt_start_program_args4 - // - this.txt_start_program_args4.Location = new System.Drawing.Point(397, 50); - this.txt_start_program_args4.Name = "txt_start_program_args4"; - this.txt_start_program_args4.Size = new System.Drawing.Size(540, 26); - this.txt_start_program_args4.TabIndex = 14; - this.txt_start_program_args4.Visible = false; - // - // cb_start_program_pass_args4 - // - this.cb_start_program_pass_args4.AutoSize = true; - this.cb_start_program_pass_args4.ForeColor = System.Drawing.Color.White; - this.cb_start_program_pass_args4.Location = new System.Drawing.Point(167, 52); - this.cb_start_program_pass_args4.Name = "cb_start_program_pass_args4"; - this.cb_start_program_pass_args4.Size = new System.Drawing.Size(228, 24); - this.cb_start_program_pass_args4.TabIndex = 13; - this.cb_start_program_pass_args4.Text = "Pass arguments to program:"; - this.cb_start_program_pass_args4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_pass_args4.UseVisualStyleBackColor = true; - this.cb_start_program_pass_args4.Visible = false; - this.cb_start_program_pass_args4.CheckedChanged += new System.EventHandler(this.cb_start_program_pass_args4_CheckedChanged); - // - // lbl_start_program4 - // - this.lbl_start_program4.AutoSize = true; - this.lbl_start_program4.Location = new System.Drawing.Point(46, 14); - this.lbl_start_program4.Name = "lbl_start_program4"; - this.lbl_start_program4.Size = new System.Drawing.Size(244, 20); - this.lbl_start_program4.TabIndex = 0; - this.lbl_start_program4.Text = "Choose a program to start fourth:"; - this.lbl_start_program4.Click += new System.EventHandler(this.lbl_start_program4_Click); - // - // pnl_start_program3 - // - this.pnl_start_program3.Controls.Add(this.cb_dont_start_if_running3); - this.pnl_start_program3.Controls.Add(this.cb_start_program3); - this.pnl_start_program3.Controls.Add(this.txt_start_program3); - this.pnl_start_program3.Controls.Add(this.cb_start_program_close3); - this.pnl_start_program3.Controls.Add(this.btn_start_program3); - this.pnl_start_program3.Controls.Add(this.txt_start_program_args3); - this.pnl_start_program3.Controls.Add(this.cb_start_program_pass_args3); - this.pnl_start_program3.Controls.Add(this.lbl_start_program3); - this.pnl_start_program3.Location = new System.Drawing.Point(48, 306); - this.pnl_start_program3.Name = "pnl_start_program3"; - this.pnl_start_program3.Size = new System.Drawing.Size(959, 124); - this.pnl_start_program3.TabIndex = 18; - // - // cb_dont_start_if_running3 - // - this.cb_dont_start_if_running3.AutoSize = true; - this.cb_dont_start_if_running3.ForeColor = System.Drawing.Color.White; - this.cb_dont_start_if_running3.Location = new System.Drawing.Point(167, 82); - this.cb_dont_start_if_running3.Name = "cb_dont_start_if_running3"; - this.cb_dont_start_if_running3.Size = new System.Drawing.Size(289, 24); - this.cb_dont_start_if_running3.TabIndex = 20; - this.cb_dont_start_if_running3.Text = "Don\'t start if program already running"; - this.cb_dont_start_if_running3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_dont_start_if_running3.UseVisualStyleBackColor = true; - this.cb_dont_start_if_running3.Visible = false; - // - // cb_start_program3 - // - this.cb_start_program3.Location = new System.Drawing.Point(21, 18); - this.cb_start_program3.Name = "cb_start_program3"; - this.cb_start_program3.Size = new System.Drawing.Size(15, 14); - this.cb_start_program3.TabIndex = 18; - this.cb_start_program3.UseVisualStyleBackColor = true; - this.cb_start_program3.CheckedChanged += new System.EventHandler(this.cb_start_program3_CheckedChanged); - // - // txt_start_program3 - // - this.txt_start_program3.Location = new System.Drawing.Point(300, 11); - this.txt_start_program3.Name = "txt_start_program3"; - this.txt_start_program3.Size = new System.Drawing.Size(535, 26); - this.txt_start_program3.TabIndex = 17; - this.txt_start_program3.Visible = false; - // - // cb_start_program_close3 - // - this.cb_start_program_close3.AutoSize = true; - this.cb_start_program_close3.ForeColor = System.Drawing.Color.White; - this.cb_start_program_close3.Location = new System.Drawing.Point(547, 82); - this.cb_start_program_close3.Name = "cb_start_program_close3"; - this.cb_start_program_close3.Size = new System.Drawing.Size(398, 24); - this.cb_start_program_close3.TabIndex = 16; - this.cb_start_program_close3.Text = "Close started program when you finish playing Game"; - this.cb_start_program_close3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_close3.UseVisualStyleBackColor = true; - this.cb_start_program_close3.Visible = false; - // - // btn_start_program3 - // - this.btn_start_program3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btn_start_program3.ForeColor = System.Drawing.Color.White; - this.btn_start_program3.Location = new System.Drawing.Point(851, 10); - this.btn_start_program3.Name = "btn_start_program3"; - this.btn_start_program3.Size = new System.Drawing.Size(85, 27); - this.btn_start_program3.TabIndex = 15; - this.btn_start_program3.Text = "Choose"; - this.btn_start_program3.UseVisualStyleBackColor = true; - this.btn_start_program3.Visible = false; - this.btn_start_program3.Click += new System.EventHandler(this.btn_start_program3_Click); - // - // txt_start_program_args3 - // - this.txt_start_program_args3.Location = new System.Drawing.Point(397, 50); - this.txt_start_program_args3.Name = "txt_start_program_args3"; - this.txt_start_program_args3.Size = new System.Drawing.Size(540, 26); - this.txt_start_program_args3.TabIndex = 14; - this.txt_start_program_args3.Visible = false; - // - // cb_start_program_pass_args3 - // - this.cb_start_program_pass_args3.AutoSize = true; - this.cb_start_program_pass_args3.ForeColor = System.Drawing.Color.White; - this.cb_start_program_pass_args3.Location = new System.Drawing.Point(167, 52); - this.cb_start_program_pass_args3.Name = "cb_start_program_pass_args3"; - this.cb_start_program_pass_args3.Size = new System.Drawing.Size(228, 24); - this.cb_start_program_pass_args3.TabIndex = 13; - this.cb_start_program_pass_args3.Text = "Pass arguments to program:"; - this.cb_start_program_pass_args3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_pass_args3.UseVisualStyleBackColor = true; - this.cb_start_program_pass_args3.Visible = false; - this.cb_start_program_pass_args3.CheckedChanged += new System.EventHandler(this.cb_start_program_pass_args3_CheckedChanged); - // - // lbl_start_program3 - // - this.lbl_start_program3.AutoSize = true; - this.lbl_start_program3.Location = new System.Drawing.Point(46, 14); - this.lbl_start_program3.Name = "lbl_start_program3"; - this.lbl_start_program3.Size = new System.Drawing.Size(233, 20); - this.lbl_start_program3.TabIndex = 0; - this.lbl_start_program3.Text = "Choose a program to start third:"; - this.lbl_start_program3.Click += new System.EventHandler(this.lbl_start_program3_Click); - // - // pnl_start_program2 - // - this.pnl_start_program2.Controls.Add(this.cb_dont_start_if_running2); - this.pnl_start_program2.Controls.Add(this.cb_start_program2); - this.pnl_start_program2.Controls.Add(this.txt_start_program2); - this.pnl_start_program2.Controls.Add(this.cb_start_program_close2); - this.pnl_start_program2.Controls.Add(this.btn_start_program2); - this.pnl_start_program2.Controls.Add(this.txt_start_program_args2); - this.pnl_start_program2.Controls.Add(this.cb_start_program_pass_args2); - this.pnl_start_program2.Controls.Add(this.lbl_start_program2); - this.pnl_start_program2.Location = new System.Drawing.Point(48, 167); - this.pnl_start_program2.Name = "pnl_start_program2"; - this.pnl_start_program2.Size = new System.Drawing.Size(959, 124); - this.pnl_start_program2.TabIndex = 18; - // - // cb_dont_start_if_running2 - // - this.cb_dont_start_if_running2.AutoSize = true; - this.cb_dont_start_if_running2.ForeColor = System.Drawing.Color.White; - this.cb_dont_start_if_running2.Location = new System.Drawing.Point(167, 82); - this.cb_dont_start_if_running2.Name = "cb_dont_start_if_running2"; - this.cb_dont_start_if_running2.Size = new System.Drawing.Size(289, 24); - this.cb_dont_start_if_running2.TabIndex = 19; - this.cb_dont_start_if_running2.Text = "Don\'t start if program already running"; - this.cb_dont_start_if_running2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_dont_start_if_running2.UseVisualStyleBackColor = true; - this.cb_dont_start_if_running2.Visible = false; - // - // cb_start_program2 - // - this.cb_start_program2.Location = new System.Drawing.Point(21, 18); - this.cb_start_program2.Name = "cb_start_program2"; - this.cb_start_program2.Size = new System.Drawing.Size(15, 14); - this.cb_start_program2.TabIndex = 18; - this.cb_start_program2.UseVisualStyleBackColor = true; - this.cb_start_program2.CheckedChanged += new System.EventHandler(this.cb_start_program2_CheckedChanged); - // - // txt_start_program2 - // - this.txt_start_program2.Location = new System.Drawing.Point(301, 11); - this.txt_start_program2.Name = "txt_start_program2"; - this.txt_start_program2.Size = new System.Drawing.Size(534, 26); - this.txt_start_program2.TabIndex = 17; - this.txt_start_program2.Visible = false; - // - // cb_start_program_close2 - // - this.cb_start_program_close2.AutoSize = true; - this.cb_start_program_close2.ForeColor = System.Drawing.Color.White; - this.cb_start_program_close2.Location = new System.Drawing.Point(547, 82); - this.cb_start_program_close2.Name = "cb_start_program_close2"; - this.cb_start_program_close2.Size = new System.Drawing.Size(398, 24); - this.cb_start_program_close2.TabIndex = 16; - this.cb_start_program_close2.Text = "Close started program when you finish playing Game"; - this.cb_start_program_close2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_close2.UseVisualStyleBackColor = true; - this.cb_start_program_close2.Visible = false; - // - // btn_start_program2 - // - this.btn_start_program2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btn_start_program2.ForeColor = System.Drawing.Color.White; - this.btn_start_program2.Location = new System.Drawing.Point(852, 10); - this.btn_start_program2.Name = "btn_start_program2"; - this.btn_start_program2.Size = new System.Drawing.Size(85, 27); - this.btn_start_program2.TabIndex = 15; - this.btn_start_program2.Text = "Choose"; - this.btn_start_program2.UseVisualStyleBackColor = true; - this.btn_start_program2.Visible = false; - this.btn_start_program2.Click += new System.EventHandler(this.btn_start_program2_Click); - // - // txt_start_program_args2 - // - this.txt_start_program_args2.Location = new System.Drawing.Point(397, 50); - this.txt_start_program_args2.Name = "txt_start_program_args2"; - this.txt_start_program_args2.Size = new System.Drawing.Size(540, 26); - this.txt_start_program_args2.TabIndex = 14; - this.txt_start_program_args2.Visible = false; - // - // cb_start_program_pass_args2 - // - this.cb_start_program_pass_args2.AutoSize = true; - this.cb_start_program_pass_args2.ForeColor = System.Drawing.Color.White; - this.cb_start_program_pass_args2.Location = new System.Drawing.Point(167, 52); - this.cb_start_program_pass_args2.Name = "cb_start_program_pass_args2"; - this.cb_start_program_pass_args2.Size = new System.Drawing.Size(228, 24); - this.cb_start_program_pass_args2.TabIndex = 13; - this.cb_start_program_pass_args2.Text = "Pass arguments to program:"; - this.cb_start_program_pass_args2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_pass_args2.UseVisualStyleBackColor = true; - this.cb_start_program_pass_args2.Visible = false; - this.cb_start_program_pass_args2.CheckedChanged += new System.EventHandler(this.cb_start_program_pass_args2_CheckedChanged); - // - // lbl_start_program2 - // - this.lbl_start_program2.AutoSize = true; - this.lbl_start_program2.Location = new System.Drawing.Point(46, 14); - this.lbl_start_program2.Name = "lbl_start_program2"; - this.lbl_start_program2.Size = new System.Drawing.Size(254, 20); - this.lbl_start_program2.TabIndex = 0; - this.lbl_start_program2.Text = "Choose a program to start second:"; - this.lbl_start_program2.Click += new System.EventHandler(this.lbl_start_program2_Click); - // - // pnl_start_program1 - // - this.pnl_start_program1.Controls.Add(this.cb_dont_start_if_running1); - this.pnl_start_program1.Controls.Add(this.cb_start_program1); - this.pnl_start_program1.Controls.Add(this.txt_start_program1); - this.pnl_start_program1.Controls.Add(this.cb_start_program_close1); - this.pnl_start_program1.Controls.Add(this.btn_start_program1); - this.pnl_start_program1.Controls.Add(this.txt_start_program_args1); - this.pnl_start_program1.Controls.Add(this.cb_start_program_pass_args1); - this.pnl_start_program1.Controls.Add(this.lbl_start_program1); - this.pnl_start_program1.Location = new System.Drawing.Point(48, 28); - this.pnl_start_program1.Name = "pnl_start_program1"; - this.pnl_start_program1.Size = new System.Drawing.Size(959, 124); - this.pnl_start_program1.TabIndex = 0; - // - // cb_dont_start_if_running1 - // - this.cb_dont_start_if_running1.AutoSize = true; - this.cb_dont_start_if_running1.ForeColor = System.Drawing.Color.White; - this.cb_dont_start_if_running1.Location = new System.Drawing.Point(167, 82); - this.cb_dont_start_if_running1.Name = "cb_dont_start_if_running1"; - this.cb_dont_start_if_running1.Size = new System.Drawing.Size(289, 24); - this.cb_dont_start_if_running1.TabIndex = 18; - this.cb_dont_start_if_running1.Text = "Don\'t start if program already running"; - this.cb_dont_start_if_running1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_dont_start_if_running1.UseVisualStyleBackColor = true; - this.cb_dont_start_if_running1.Visible = false; - // - // cb_start_program1 - // - this.cb_start_program1.Location = new System.Drawing.Point(21, 18); - this.cb_start_program1.Name = "cb_start_program1"; - this.cb_start_program1.Size = new System.Drawing.Size(15, 14); - this.cb_start_program1.TabIndex = 0; - this.cb_start_program1.UseVisualStyleBackColor = true; - this.cb_start_program1.CheckedChanged += new System.EventHandler(this.cb_start_program1_CheckedChanged); - // - // txt_start_program1 - // - this.txt_start_program1.Location = new System.Drawing.Point(300, 11); - this.txt_start_program1.Name = "txt_start_program1"; - this.txt_start_program1.Size = new System.Drawing.Size(535, 26); - this.txt_start_program1.TabIndex = 17; - this.txt_start_program1.Visible = false; - // - // cb_start_program_close1 - // - this.cb_start_program_close1.AutoSize = true; - this.cb_start_program_close1.ForeColor = System.Drawing.Color.White; - this.cb_start_program_close1.Location = new System.Drawing.Point(547, 82); - this.cb_start_program_close1.Name = "cb_start_program_close1"; - this.cb_start_program_close1.Size = new System.Drawing.Size(398, 24); - this.cb_start_program_close1.TabIndex = 16; - this.cb_start_program_close1.Text = "Close started program when you finish playing Game"; - this.cb_start_program_close1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_close1.UseVisualStyleBackColor = true; - this.cb_start_program_close1.Visible = false; - // - // btn_start_program1 - // - this.btn_start_program1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btn_start_program1.ForeColor = System.Drawing.Color.White; - this.btn_start_program1.Location = new System.Drawing.Point(851, 10); - this.btn_start_program1.Name = "btn_start_program1"; - this.btn_start_program1.Size = new System.Drawing.Size(85, 27); - this.btn_start_program1.TabIndex = 15; - this.btn_start_program1.Text = "Choose"; - this.btn_start_program1.UseVisualStyleBackColor = true; - this.btn_start_program1.Visible = false; - this.btn_start_program1.Click += new System.EventHandler(this.btn_start_program1_Click); - // - // txt_start_program_args1 - // - this.txt_start_program_args1.Location = new System.Drawing.Point(397, 50); - this.txt_start_program_args1.Name = "txt_start_program_args1"; - this.txt_start_program_args1.Size = new System.Drawing.Size(540, 26); - this.txt_start_program_args1.TabIndex = 14; - this.txt_start_program_args1.Visible = false; - // - // cb_start_program_pass_args1 - // - this.cb_start_program_pass_args1.AutoSize = true; - this.cb_start_program_pass_args1.ForeColor = System.Drawing.Color.White; - this.cb_start_program_pass_args1.Location = new System.Drawing.Point(167, 52); - this.cb_start_program_pass_args1.Name = "cb_start_program_pass_args1"; - this.cb_start_program_pass_args1.Size = new System.Drawing.Size(228, 24); - this.cb_start_program_pass_args1.TabIndex = 13; - this.cb_start_program_pass_args1.Text = "Pass arguments to program:"; - this.cb_start_program_pass_args1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.cb_start_program_pass_args1.UseVisualStyleBackColor = true; - this.cb_start_program_pass_args1.Visible = false; - this.cb_start_program_pass_args1.CheckedChanged += new System.EventHandler(this.cb_start_program_pass_args1_CheckedChanged); - // - // lbl_start_program1 - // - this.lbl_start_program1.AutoSize = true; - this.lbl_start_program1.Location = new System.Drawing.Point(46, 14); - this.lbl_start_program1.Name = "lbl_start_program1"; - this.lbl_start_program1.Size = new System.Drawing.Size(228, 20); - this.lbl_start_program1.TabIndex = 0; - this.lbl_start_program1.Text = "Choose a program to start first:"; - this.lbl_start_program1.Click += new System.EventHandler(this.lbl_start_program1_Click); + // pnl_start_programs + // + this.pnl_start_programs.AutoScroll = true; + this.pnl_start_programs.BackColor = System.Drawing.Color.White; + this.pnl_start_programs.Location = new System.Drawing.Point(58, 65); + this.pnl_start_programs.Name = "pnl_start_programs"; + this.pnl_start_programs.Size = new System.Drawing.Size(987, 507); + this.pnl_start_programs.TabIndex = 2; // // tabp_game // @@ -1745,14 +1300,6 @@ namespace DisplayMagician.UIForms this.gb_audio_volume.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).EndInit(); this.tabp_before.ResumeLayout(false); - this.pnl_start_program4.ResumeLayout(false); - this.pnl_start_program4.PerformLayout(); - this.pnl_start_program3.ResumeLayout(false); - this.pnl_start_program3.PerformLayout(); - this.pnl_start_program2.ResumeLayout(false); - this.pnl_start_program2.PerformLayout(); - this.pnl_start_program1.ResumeLayout(false); - this.pnl_start_program1.PerformLayout(); this.tabp_game.ResumeLayout(false); this.tabp_game.PerformLayout(); this.p_standalone.ResumeLayout(false); @@ -1820,38 +1367,6 @@ namespace DisplayMagician.UIForms private System.Windows.Forms.Label lbl_shortcut_name; private System.Windows.Forms.Button btn_exe_to_start; private System.Windows.Forms.CheckBox cb_autosuggest; - private System.Windows.Forms.Panel pnl_start_program1; - private System.Windows.Forms.Label lbl_start_program1; - private System.Windows.Forms.Panel pnl_start_program4; - private System.Windows.Forms.TextBox txt_start_program4; - private System.Windows.Forms.CheckBox cb_start_program_close4; - private System.Windows.Forms.Button btn_start_program4; - private System.Windows.Forms.TextBox txt_start_program_args4; - private System.Windows.Forms.CheckBox cb_start_program_pass_args4; - private System.Windows.Forms.Label lbl_start_program4; - private System.Windows.Forms.Panel pnl_start_program3; - private System.Windows.Forms.TextBox txt_start_program3; - private System.Windows.Forms.CheckBox cb_start_program_close3; - private System.Windows.Forms.Button btn_start_program3; - private System.Windows.Forms.TextBox txt_start_program_args3; - private System.Windows.Forms.CheckBox cb_start_program_pass_args3; - private System.Windows.Forms.Label lbl_start_program3; - private System.Windows.Forms.Panel pnl_start_program2; - private System.Windows.Forms.TextBox txt_start_program2; - private System.Windows.Forms.CheckBox cb_start_program_close2; - private System.Windows.Forms.Button btn_start_program2; - private System.Windows.Forms.TextBox txt_start_program_args2; - private System.Windows.Forms.CheckBox cb_start_program_pass_args2; - private System.Windows.Forms.Label lbl_start_program2; - private System.Windows.Forms.TextBox txt_start_program1; - private System.Windows.Forms.CheckBox cb_start_program_close1; - private System.Windows.Forms.Button btn_start_program1; - private System.Windows.Forms.TextBox txt_start_program_args1; - private System.Windows.Forms.CheckBox cb_start_program_pass_args1; - private System.Windows.Forms.CheckBox cb_start_program4; - private System.Windows.Forms.CheckBox cb_start_program3; - private System.Windows.Forms.CheckBox cb_start_program2; - private System.Windows.Forms.CheckBox cb_start_program1; private System.Windows.Forms.TabPage tabp_audio; private System.Windows.Forms.GroupBox gb_display_after; private System.Windows.Forms.RadioButton rb_switch_display_permanent; @@ -1883,10 +1398,6 @@ namespace DisplayMagician.UIForms private System.Windows.Forms.RadioButton rb_switch_capture_permanent; private System.Windows.Forms.RadioButton rb_switch_capture_temp; private System.Windows.Forms.Label lbl_no_game_libraries; - private System.Windows.Forms.CheckBox cb_dont_start_if_running4; - private System.Windows.Forms.CheckBox cb_dont_start_if_running3; - private System.Windows.Forms.CheckBox cb_dont_start_if_running2; - private System.Windows.Forms.CheckBox cb_dont_start_if_running1; private System.Windows.Forms.Label lbl_disabled_shortcut_audio_chipset; private System.Windows.Forms.Label lbl_no_active_audio_devices; private System.Windows.Forms.Label lbl_no_active_capture_devices; @@ -1895,5 +1406,6 @@ namespace DisplayMagician.UIForms private System.Windows.Forms.CheckBox cb_wait_alternative_game; private System.Windows.Forms.Button btn_hotkey; private System.Windows.Forms.Label lbl_hotkey_assigned; + private System.Windows.Forms.Panel pnl_start_programs; } } \ No newline at end of file diff --git a/DisplayMagician/UIForms/ShortcutForm.cs b/DisplayMagician/UIForms/ShortcutForm.cs index 7d553b4..f52d820 100644 --- a/DisplayMagician/UIForms/ShortcutForm.cs +++ b/DisplayMagician/UIForms/ShortcutForm.cs @@ -26,7 +26,7 @@ namespace DisplayMagician.UIForms private ProfileAdaptor _profileAdaptor; //private List _loadedProfiles = new List(); - private ProfileItem _profileToUse= null; + private ProfileItem _profileToUse = null; private GameStruct _gameToUse; private Executable _executableToUse; private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary; @@ -47,7 +47,7 @@ namespace DisplayMagician.UIForms private bool _loadedShortcut = false; private bool _autoName = true; private string _gameId = "0"; - private string _uuid = ""; + private string _uuid = ""; private CoreAudioController audioController = null; private List audioDevices = null; private CoreAudioDevice selectedAudioDevice = null; @@ -76,7 +76,7 @@ namespace DisplayMagician.UIForms ilv_saved_profiles.SetRenderer(new ProfileILVRenderer()); } - catch(Exception ex) + catch (Exception ex) { logger.Error(ex, $"ShortcutForm/ShortcutForm: Exception while trying to setup the game ImageListView and set the render."); } @@ -92,7 +92,8 @@ namespace DisplayMagician.UIForms { logger.Warn(ex, $"ShortcutForm/ShortcutForm: Exception while trying to initialise CoreAudioController in ShortcutForm. Audio Chipset on your computer is not supported. You will be unable to set audio settings."); } - } + + } public ShortcutItem Shortcut { @@ -453,8 +454,10 @@ namespace DisplayMagician.UIForms _capturePermanence = ShortcutPermanence.Temporary; } + + // Save the start program 1 - StartProgram myStartProgram = new StartProgram + /*StartProgram myStartProgram = new StartProgram { Priority = 1, Enabled = cb_start_program1.Checked, @@ -500,7 +503,7 @@ namespace DisplayMagician.UIForms CloseOnFinish = cb_start_program_close4.Checked, DontStartIfAlreadyRunning = cb_dont_start_if_running4.Checked }; - _startPrograms.Add(myStartProgram); + _startPrograms.Add(myStartProgram); */ // Now we create the Shortcut Object ready to save // If we're launching a game @@ -1155,10 +1158,21 @@ namespace DisplayMagician.UIForms if (_shortcutToEdit.StartPrograms is List && _shortcutToEdit.StartPrograms.Count > 0) { - foreach (StartProgram myStartProgram in _shortcutToEdit.StartPrograms) + int x = 0; + int y = 0; + + // Order the inital list in order of priority + foreach (StartProgram myStartProgram in _shortcutToEdit.StartPrograms.OrderBy(sp => sp.Priority)) { - // Update the 4 programs to start + StartProgramControl startProgramControl = new StartProgramControl(myStartProgram); + startProgramControl.Location = new Point(x, y); + startProgramControl.BringToFront(); + startProgramControl.Margin = DefaultMargin; + startProgramControl.Width = pnl_start_programs.Width; + pnl_start_programs.Controls.Add(startProgramControl); + y += startProgramControl.Height; + /*// Update the 4 programs to start switch (myStartProgram.Priority) { case 1: @@ -1194,7 +1208,7 @@ namespace DisplayMagician.UIForms cb_dont_start_if_running4.Checked = myStartProgram.DontStartIfAlreadyRunning; break; - } + }*/ } } @@ -1613,194 +1627,7 @@ namespace DisplayMagician.UIForms } return textToReturn; } - private void btn_start_program1_Click(object sender, EventArgs e) - { - txt_start_program1.Text = getExeFile(); - } - - private void btn_start_program2_Click(object sender, EventArgs e) - { - txt_start_program2.Text = getExeFile(); - } - - private void btn_start_program3_Click(object sender, EventArgs e) - { - txt_start_program3.Text = getExeFile(); - } - - private void btn_start_program4_Click(object sender, EventArgs e) - { - txt_start_program4.Text = getExeFile(); - } - - private void cb_start_program1_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 1 fields - if (cb_start_program1.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program1.Visible = true; - btn_start_program1.Visible = true; - cb_start_program_pass_args1.Visible = true; - cb_start_program_close1.Visible = true; - cb_dont_start_if_running1.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program1.Visible = false; - btn_start_program1.Visible = false; - cb_start_program_pass_args1.Visible = false; - cb_start_program_close1.Visible = false; - cb_dont_start_if_running1.Visible = false; - } - } - - private void cb_start_program2_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 2 fields - if (cb_start_program2.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program2.Visible = true; - btn_start_program2.Visible = true; - cb_start_program_pass_args2.Visible = true; - cb_start_program_close2.Visible = true; - cb_dont_start_if_running2.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program2.Visible = false; - btn_start_program2.Visible = false; - cb_start_program_pass_args2.Visible = false; - cb_start_program_close2.Visible = false; - cb_dont_start_if_running2.Visible = false; - } - } - - private void cb_start_program3_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 3 fields - if (cb_start_program3.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program3.Visible = true; - btn_start_program3.Visible = true; - cb_start_program_pass_args3.Visible = true; - cb_start_program_close3.Visible = true; - cb_dont_start_if_running3.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program3.Visible = false; - btn_start_program3.Visible = false; - cb_start_program_pass_args3.Visible = false; - cb_start_program_close3.Visible = false; - cb_dont_start_if_running3.Visible = false; - } - } - - private void cb_start_program4_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 4 fields - if (cb_start_program4.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program4.Visible = true; - btn_start_program4.Visible = true; - cb_start_program_pass_args4.Visible = true; - cb_start_program_close4.Visible = true; - cb_dont_start_if_running4.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program4.Visible = false; - btn_start_program4.Visible = false; - cb_start_program_pass_args4.Visible = false; - cb_start_program_close4.Visible = false; - cb_dont_start_if_running4.Visible = false; - } - } - - private void cb_start_program_pass_args1_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 1 fields - if (cb_start_program_pass_args1.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program_args1.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program_args1.Visible = false; - } - } - - private void cb_start_program_pass_args2_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 2 fields - if (cb_start_program_pass_args2.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program_args2.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program_args2.Visible = false; - } - } - - private void cb_start_program_pass_args3_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 3 fields - if (cb_start_program_pass_args3.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program_args3.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program_args3.Visible = false; - } - } - - private void cb_start_program_pass_args4_CheckedChanged(object sender, EventArgs e) - { - if (_loadedShortcut) - _isUnsaved = true; - // Disable the start program 4 fields - if (cb_start_program_pass_args4.Checked) - { - // Enable the Executable Arguments Text field - txt_start_program_args4.Visible = true; - } - else - { - // Disable the Executable Arguments Text field - txt_start_program_args4.Visible = false; - } - } - + private void rb_no_change_audio_CheckedChanged(object sender, EventArgs e) { if (rb_no_change_audio.Checked) @@ -2171,37 +1998,6 @@ namespace DisplayMagician.UIForms _captureVolume = Convert.ToDecimal(nud_capture_volume.Value); } - private void lbl_start_program1_Click(object sender, EventArgs e) - { - if (!cb_start_program1.Checked) - cb_start_program1.CheckState = CheckState.Checked; - else - cb_start_program1.CheckState = CheckState.Unchecked; - } - - private void lbl_start_program2_Click(object sender, EventArgs e) - { - if (!cb_start_program2.Checked) - cb_start_program2.CheckState = CheckState.Checked; - else - cb_start_program2.CheckState = CheckState.Unchecked; - } - - private void lbl_start_program3_Click(object sender, EventArgs e) - { - if (!cb_start_program3.Checked) - cb_start_program3.CheckState = CheckState.Checked; - else - cb_start_program3.CheckState = CheckState.Unchecked; - } - - private void lbl_start_program4_Click(object sender, EventArgs e) - { - if (!cb_start_program4.Checked) - cb_start_program4.CheckState = CheckState.Checked; - else - cb_start_program4.CheckState = CheckState.Unchecked; - } private void cb_wait_alternative_game_CheckedChanged(object sender, EventArgs e) { @@ -2219,6 +2015,7 @@ namespace DisplayMagician.UIForms } } + private void btn_choose_alternative_game_Click(object sender, EventArgs e) { if (dialog_open.ShowDialog(this) == DialogResult.OK) diff --git a/DisplayMagician/UIForms/StartProgramControl.Designer.cs b/DisplayMagician/UIForms/StartProgramControl.Designer.cs new file mode 100644 index 0000000..3580240 --- /dev/null +++ b/DisplayMagician/UIForms/StartProgramControl.Designer.cs @@ -0,0 +1,182 @@ + +namespace DisplayMagician.UIForms +{ + partial class StartProgramControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.cb_dont_start_if_running = new System.Windows.Forms.CheckBox(); + this.txt_start_program = new System.Windows.Forms.TextBox(); + this.cb_start_program_close = new System.Windows.Forms.CheckBox(); + this.btn_start_program = new System.Windows.Forms.Button(); + this.txt_start_program_args = new System.Windows.Forms.TextBox(); + this.cb_start_program_pass_args = new System.Windows.Forms.CheckBox(); + this.btn_delete = new System.Windows.Forms.Button(); + this.cb_start_program = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // cb_dont_start_if_running + // + 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.ForeColor = System.Drawing.Color.White; + this.cb_dont_start_if_running.Location = new System.Drawing.Point(135, 97); + 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.TabIndex = 26; + this.cb_dont_start_if_running.Text = "Don\'t start if program already running"; + this.cb_dont_start_if_running.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.cb_dont_start_if_running.UseVisualStyleBackColor = true; + this.cb_dont_start_if_running.Visible = false; + // + // txt_start_program + // + this.txt_start_program.BackColor = System.Drawing.Color.White; + this.txt_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txt_start_program.ForeColor = System.Drawing.Color.Black; + this.txt_start_program.Location = new System.Drawing.Point(268, 20); + this.txt_start_program.Name = "txt_start_program"; + this.txt_start_program.Size = new System.Drawing.Size(535, 26); + this.txt_start_program.TabIndex = 25; + this.txt_start_program.Visible = false; + // + // cb_start_program_close + // + this.cb_start_program_close.AutoSize = true; + 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.Location = new System.Drawing.Point(515, 97); + this.cb_start_program_close.Name = "cb_start_program_close"; + this.cb_start_program_close.Size = new System.Drawing.Size(398, 24); + this.cb_start_program_close.TabIndex = 24; + this.cb_start_program_close.Text = "Close started program when you finish playing Game"; + this.cb_start_program_close.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.cb_start_program_close.UseVisualStyleBackColor = true; + this.cb_start_program_close.Visible = false; + // + // btn_start_program + // + this.btn_start_program.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_start_program.ForeColor = System.Drawing.Color.White; + this.btn_start_program.Location = new System.Drawing.Point(819, 19); + this.btn_start_program.Name = "btn_start_program"; + this.btn_start_program.Size = new System.Drawing.Size(85, 27); + this.btn_start_program.TabIndex = 23; + this.btn_start_program.Text = "Choose"; + this.btn_start_program.UseVisualStyleBackColor = true; + this.btn_start_program.Visible = false; + this.btn_start_program.Click += new System.EventHandler(this.btn_start_program_Click); + // + // txt_start_program_args + // + 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.ForeColor = System.Drawing.Color.Black; + this.txt_start_program_args.Location = new System.Drawing.Point(365, 60); + this.txt_start_program_args.Name = "txt_start_program_args"; + this.txt_start_program_args.Size = new System.Drawing.Size(540, 26); + this.txt_start_program_args.TabIndex = 22; + this.txt_start_program_args.Visible = false; + // + // cb_start_program_pass_args + // + 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.ForeColor = System.Drawing.Color.White; + this.cb_start_program_pass_args.Location = new System.Drawing.Point(135, 62); + 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.TabIndex = 21; + this.cb_start_program_pass_args.Text = "Pass arguments to program:"; + this.cb_start_program_pass_args.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.cb_start_program_pass_args.UseVisualStyleBackColor = true; + this.cb_start_program_pass_args.Visible = false; + this.cb_start_program_pass_args.CheckedChanged += new System.EventHandler(this.cb_start_program_pass_args_CheckedChanged); + // + // btn_delete + // + this.btn_delete.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_delete.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_delete.ForeColor = System.Drawing.Color.White; + this.btn_delete.Location = new System.Drawing.Point(933, 3); + this.btn_delete.Name = "btn_delete"; + this.btn_delete.Size = new System.Drawing.Size(29, 27); + this.btn_delete.TabIndex = 27; + this.btn_delete.Text = "X"; + this.btn_delete.UseVisualStyleBackColor = true; + this.btn_delete.Visible = false; + this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); + // + // cb_start_program + // + this.cb_start_program.AutoSize = true; + this.cb_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cb_start_program.ForeColor = System.Drawing.Color.White; + this.cb_start_program.Location = new System.Drawing.Point(34, 21); + this.cb_start_program.Name = "cb_start_program"; + this.cb_start_program.Size = new System.Drawing.Size(222, 24); + this.cb_start_program.TabIndex = 28; + this.cb_start_program.Text = "Start the following program:"; + this.cb_start_program.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.cb_start_program.UseVisualStyleBackColor = true; + this.cb_start_program.Visible = false; + this.cb_start_program.CheckedChanged += new System.EventHandler(this.cb_start_program_CheckedChanged); + // + // StartProgramControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.Controls.Add(this.cb_start_program); + this.Controls.Add(this.btn_delete); + this.Controls.Add(this.cb_dont_start_if_running); + this.Controls.Add(this.txt_start_program); + this.Controls.Add(this.cb_start_program_close); + this.Controls.Add(this.btn_start_program); + this.Controls.Add(this.txt_start_program_args); + this.Controls.Add(this.cb_start_program_pass_args); + this.ForeColor = System.Drawing.Color.White; + this.Name = "StartProgramControl"; + this.Size = new System.Drawing.Size(965, 136); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox cb_dont_start_if_running; + private System.Windows.Forms.TextBox txt_start_program; + private System.Windows.Forms.CheckBox cb_start_program_close; + private System.Windows.Forms.Button btn_start_program; + private System.Windows.Forms.TextBox txt_start_program_args; + private System.Windows.Forms.CheckBox cb_start_program_pass_args; + private System.Windows.Forms.Button btn_delete; + private System.Windows.Forms.CheckBox cb_start_program; + } +} diff --git a/DisplayMagician/UIForms/StartProgramControl.cs b/DisplayMagician/UIForms/StartProgramControl.cs new file mode 100644 index 0000000..97ec217 --- /dev/null +++ b/DisplayMagician/UIForms/StartProgramControl.cs @@ -0,0 +1,125 @@ +using DisplayMagician.Resources; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DisplayMagician.UIForms +{ + public partial class StartProgramControl : UserControl + { + public StartProgramControl() + { + InitializeComponent(); + } + + public StartProgramControl(StartProgram startProgram) + { + InitializeComponent(); + + // Now initialise the controls + txt_start_program.Text = startProgram.Executable; + txt_start_program.BackColor = Color.White; + txt_start_program.ForeColor = Color.Black; + txt_start_program.Visible= true; + txt_start_program.BringToFront(); + cb_start_program.Checked = startProgram.Enabled; + txt_start_program.ForeColor = Color.White; + cb_start_program_pass_args.Checked = startProgram.ExecutableArgumentsRequired; + txt_start_program_args.Text = startProgram.Arguments; + cb_start_program_close.Checked = startProgram.CloseOnFinish; + cb_dont_start_if_running.Checked = startProgram.DontStartIfAlreadyRunning; + + + } + + + private void btn_start_program_Click(object sender, EventArgs e) + { + txt_start_program.Text = getExeFile(); + } + + private void cb_start_program_CheckedChanged(object sender, EventArgs e) + { + // Disable the start program 1 fields + if (cb_start_program.Checked) + { + // Enable the Executable Arguments Text field + txt_start_program.Visible = true; + btn_start_program.Visible = true; + cb_start_program_pass_args.Visible = true; + cb_start_program_close.Visible = true; + cb_dont_start_if_running.Visible = true; + } + else + { + // Disable the Executable Arguments Text field + txt_start_program.Visible = false; + btn_start_program.Visible = false; + cb_start_program_pass_args.Visible = false; + cb_start_program_close.Visible = false; + cb_dont_start_if_running.Visible = false; + } + } + + private void cb_start_program_pass_args_CheckedChanged(object sender, EventArgs e) + { + // Disable the start program 1 fields + if (cb_start_program_pass_args.Checked) + { + // Enable the Executable Arguments Text field + txt_start_program_args.Visible = true; + } + else + { + // Disable the Executable Arguments Text field + txt_start_program_args.Visible = false; + } + } + + private string getExeFile() + { + string textToReturn = ""; + OpenFileDialog dialog_open = new OpenFileDialog(); + if (dialog_open.ShowDialog(this) == DialogResult.OK) + { + if (File.Exists(dialog_open.FileName)) + { + textToReturn = dialog_open.FileName; + dialog_open.FileName = string.Empty; + } + else + { + MessageBox.Show( + Language.Selected_file_is_not_a_valid_file, + Language.Executable, + MessageBoxButtons.OK, + MessageBoxIcon.Exclamation); + } + } + return textToReturn; + } + + private void lbl_start_program_Click(object sender, EventArgs e) + { + if (!cb_start_program.Checked) + cb_start_program.CheckState = CheckState.Checked; + else + cb_start_program.CheckState = CheckState.Unchecked; + } + + + private void btn_delete_Click(object sender, EventArgs e) + { + + } + + } + +} diff --git a/DisplayMagician/UIForms/StartProgramControl.resx b/DisplayMagician/UIForms/StartProgramControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DisplayMagician/UIForms/StartProgramControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs index eec3c55..4b04060 100644 --- a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs +++ b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs @@ -38,9 +38,6 @@ - - - @@ -77,7 +74,13 @@ - + + + + + + + @@ -237,6 +240,7 @@ +