diff --git a/DisplayMagician/ProgramSettings.cs b/DisplayMagician/ProgramSettings.cs index 6051725..6eafd8b 100644 --- a/DisplayMagician/ProgramSettings.cs +++ b/DisplayMagician/ProgramSettings.cs @@ -21,6 +21,7 @@ namespace DisplayMagician #region Instance Variables private bool _startOnBootUp = false; private bool _minimiseOnStart = false; + private bool _upgradeToPrereleases = false; private string _logLevel = NLog.LogLevel.Info.ToString(); private Keys _hotkeyMainWindow = Keys.None; private Keys _hotkeyDisplayProfileWindow = Keys.None; @@ -44,6 +45,24 @@ namespace DisplayMagician SaveSettings(); } } + + public bool UpgradeToPreReleases + { + get + { + return _upgradeToPrereleases; + } + set + { + _upgradeToPrereleases = value; + + // Because a value has changed, we need to save the setting + // to remember it for later. + if (_programSettingsLoaded) + SaveSettings(); + } + } + public bool MinimiseOnStart { get { diff --git a/DisplayMagician/UIForms/SettingsForm.Designer.cs b/DisplayMagician/UIForms/SettingsForm.Designer.cs index d8b46e4..1010b1c 100644 --- a/DisplayMagician/UIForms/SettingsForm.Designer.cs +++ b/DisplayMagician/UIForms/SettingsForm.Designer.cs @@ -47,8 +47,12 @@ namespace DisplayMagician.UIForms this.btn_hotkey_shortcuts = new System.Windows.Forms.Button(); this.btn_hotkey_display_profile = new System.Windows.Forms.Button(); this.btn_hotkey_main_window = new System.Windows.Forms.Button(); + this.gb_upgrades = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); + this.cb_upgrade_prerelease = new System.Windows.Forms.CheckBox(); this.gb_general.SuspendLayout(); this.gb_hotkeys.SuspendLayout(); + this.gb_upgrades.SuspendLayout(); this.SuspendLayout(); // // btn_back @@ -59,7 +63,7 @@ namespace DisplayMagician.UIForms this.btn_back.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown; this.btn_back.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_back.ForeColor = System.Drawing.Color.White; - this.btn_back.Location = new System.Drawing.Point(476, 650); + this.btn_back.Location = new System.Drawing.Point(1034, 434); this.btn_back.Name = "btn_back"; this.btn_back.Size = new System.Drawing.Size(75, 23); this.btn_back.TabIndex = 9; @@ -145,7 +149,7 @@ namespace DisplayMagician.UIForms this.gb_hotkeys.Controls.Add(this.btn_hotkey_main_window); this.gb_hotkeys.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gb_hotkeys.ForeColor = System.Drawing.Color.White; - this.gb_hotkeys.Location = new System.Drawing.Point(27, 235); + this.gb_hotkeys.Location = new System.Drawing.Point(584, 21); this.gb_hotkeys.Name = "gb_hotkeys"; this.gb_hotkeys.Size = new System.Drawing.Size(525, 391); this.gb_hotkeys.TabIndex = 12; @@ -282,12 +286,50 @@ namespace DisplayMagician.UIForms this.btn_hotkey_main_window.UseVisualStyleBackColor = true; this.btn_hotkey_main_window.Click += new System.EventHandler(this.btn_hotkey_main_window_Click); // + // gb_upgrades + // + this.gb_upgrades.Controls.Add(this.label2); + this.gb_upgrades.Controls.Add(this.cb_upgrade_prerelease); + this.gb_upgrades.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.gb_upgrades.ForeColor = System.Drawing.Color.White; + this.gb_upgrades.Location = new System.Drawing.Point(27, 235); + this.gb_upgrades.Name = "gb_upgrades"; + this.gb_upgrades.Size = new System.Drawing.Size(525, 177); + this.gb_upgrades.TabIndex = 13; + this.gb_upgrades.TabStop = false; + this.gb_upgrades.Text = "Upgrade Settings"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(43, 71); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(356, 13); + this.label2.TabIndex = 15; + this.label2.Text = "(NOTE: beta versions may crash and not work correctly. Use with caution)"; + // + // cb_upgrade_prerelease + // + this.cb_upgrade_prerelease.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.cb_upgrade_prerelease.AutoSize = true; + this.cb_upgrade_prerelease.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F); + this.cb_upgrade_prerelease.ForeColor = System.Drawing.Color.White; + this.cb_upgrade_prerelease.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.cb_upgrade_prerelease.Location = new System.Drawing.Point(28, 42); + this.cb_upgrade_prerelease.Name = "cb_upgrade_prerelease"; + this.cb_upgrade_prerelease.Size = new System.Drawing.Size(411, 20); + this.cb_upgrade_prerelease.TabIndex = 14; + this.cb_upgrade_prerelease.Text = "Upgrade DisplayMagician to latest beta versions when available"; + this.cb_upgrade_prerelease.UseVisualStyleBackColor = true; + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(580, 697); + this.ClientSize = new System.Drawing.Size(1142, 481); + this.Controls.Add(this.gb_upgrades); this.Controls.Add(this.gb_hotkeys); this.Controls.Add(this.gb_general); this.Controls.Add(this.btn_back); @@ -306,6 +348,8 @@ namespace DisplayMagician.UIForms this.gb_general.PerformLayout(); this.gb_hotkeys.ResumeLayout(false); this.gb_hotkeys.PerformLayout(); + this.gb_upgrades.ResumeLayout(false); + this.gb_upgrades.PerformLayout(); this.ResumeLayout(false); } @@ -329,5 +373,8 @@ namespace DisplayMagician.UIForms private System.Windows.Forms.Label lbl_hotkey_shortcut_library; private System.Windows.Forms.Label lbl_hotkey_display_profile; private System.Windows.Forms.Label lbl_hotkey_main_window; + private System.Windows.Forms.GroupBox gb_upgrades; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.CheckBox cb_upgrade_prerelease; } } \ No newline at end of file diff --git a/DisplayMagician/UIForms/SettingsForm.cs b/DisplayMagician/UIForms/SettingsForm.cs index e96ee85..ac9c7db 100644 --- a/DisplayMagician/UIForms/SettingsForm.cs +++ b/DisplayMagician/UIForms/SettingsForm.cs @@ -62,6 +62,17 @@ namespace DisplayMagician.UIForms logger.Info($"SettingsForm/SettingsForm_Load: AppProgramSettings MinimiseOnStart set to false"); } + // start upgrade settings + if (Program.AppProgramSettings.UpgradeToPreReleases) + { + cb_upgrade_prerelease.Checked = true; + logger.Info($"SettingsForm/SettingsForm_Load: AppProgramSettings UpgradeToPreReleases set to true"); + } + else + { + cb_upgrade_prerelease.Checked = false; + logger.Info($"SettingsForm/SettingsForm_Load: AppProgramSettings UpgradeToPreReleases set to false"); + } // setup loglevel on start switch (Program.AppProgramSettings.LogLevel) @@ -237,6 +248,18 @@ namespace DisplayMagician.UIForms NLog.LogManager.Configuration = config; logger.Info($"SettingsForm/SettingsForm_FormClosing: Successfully saved LogLevel as {Program.AppProgramSettings.LogLevel}"); + + // save upgrade in prereleases setting + if (cb_upgrade_prerelease.Checked) + { + Program.AppProgramSettings.UpgradeToPreReleases = true; + logger.Info($"SettingsForm/SettingsForm_FormClosing: Successfully set DisplayMagician to upgrade to pre-release versions of software"); + } + else + { + Program.AppProgramSettings.UpgradeToPreReleases = false; + logger.Info($"SettingsForm/SettingsForm_FormClosing: Successfully stopped DisplayMagician from upgrading to pre-release versions of software"); + } } private void btn_back_Click(object sender, EventArgs e)