mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed auto start functionality
DM wasn't autstarting when the checkbox on the MainForm was started. It wasn't correctly enabling the setting. It now does.
This commit is contained in:
parent
f72fc6feea
commit
2da00a55ec
@ -26,8 +26,8 @@ using System.Resources;
|
||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||
|
||||
// Version information
|
||||
[assembly: AssemblyVersion("2.1.0.71")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.71")]
|
||||
[assembly: AssemblyVersion("2.1.0.73")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.73")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
|
@ -489,7 +489,7 @@ namespace DisplayMagician.UIForms
|
||||
allowClose = false;
|
||||
// Enable the MinimiseOnStart setting
|
||||
Program.AppProgramSettings.MinimiseOnStart = true;
|
||||
Program.AppProgramSettings.StartOnBootUp = true;
|
||||
SettingsForm.SetBootMeUp(true);
|
||||
// Change the exit_button text to say 'Close'
|
||||
btn_exit.Text = "&Close";
|
||||
}
|
||||
@ -501,7 +501,7 @@ namespace DisplayMagician.UIForms
|
||||
allowClose = true;
|
||||
// Disable the MinimiseOnStart setting
|
||||
Program.AppProgramSettings.MinimiseOnStart = false;
|
||||
Program.AppProgramSettings.StartOnBootUp = false;
|
||||
SettingsForm.SetBootMeUp(false);
|
||||
// Change the exit_button text to say 'Exit'
|
||||
btn_exit.Text = "&Exit";
|
||||
|
||||
|
@ -172,10 +172,8 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
}
|
||||
|
||||
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
public static bool SetBootMeUp(bool enabled)
|
||||
{
|
||||
|
||||
logger.Info($"SettingsForm/SettingsForm_Load: AppProgramSettings LogLevel set to Trace");
|
||||
var bootMeUp = new BootMeUp
|
||||
{
|
||||
UseAlternativeOnFail = true,
|
||||
@ -184,7 +182,7 @@ namespace DisplayMagician.UIForms
|
||||
};
|
||||
|
||||
// save start on Boot up
|
||||
if (cb_start_on_boot.Checked)
|
||||
if (enabled)
|
||||
{
|
||||
Program.AppProgramSettings.StartOnBootUp = true;
|
||||
bootMeUp.Enabled = true;
|
||||
@ -192,9 +190,14 @@ namespace DisplayMagician.UIForms
|
||||
{
|
||||
logger.Error($"SettingsForm/SettingsForm_FormClosing: Failed to set up DisplayMagician to start when Windows starts");
|
||||
MessageBox.Show("There was an issue setting DisplayMagician to run when the computer starts. Please try launching DisplayMagician again as Admin to see if that helps.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Info($"SettingsForm/SettingsForm_FormClosing: Successfully set DisplayMagician to start when Windows starts");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -204,11 +207,23 @@ namespace DisplayMagician.UIForms
|
||||
{
|
||||
logger.Error($"SettingsForm/SettingsForm_FormClosing: Failed to stop DisplayMagician from starting when Windows starts");
|
||||
MessageBox.Show("There was an issue stopping DisplayMagician from running when the computer starts. Please try launching DisplayMagician again as Admin to see if that helps.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Info($"SettingsForm/SettingsForm_FormClosing: Successfully stopped DisplayMagician from starting when Windows starts");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
|
||||
logger.Info($"SettingsForm/SettingsForm_Load: Setting BootMeUp to {cb_start_on_boot.Checked}");
|
||||
SetBootMeUp(cb_start_on_boot.Checked);
|
||||
|
||||
// save minimise on close
|
||||
if (cb_minimise_notification_area.Checked)
|
||||
Program.AppProgramSettings.MinimiseOnStart = true;
|
||||
|
Loading…
Reference in New Issue
Block a user