mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Added new CreateProfile startup action
CreateProfile will just open a new DisplayProfile window and that will be used only from the Shell Extension.
This commit is contained in:
parent
45e2c32c30
commit
9522af5574
@ -132,26 +132,14 @@ namespace DisplayMagician {
|
|||||||
// This is the CreateProfile command
|
// This is the CreateProfile command
|
||||||
app.Command(DisplayMagicianStartupAction.CreateProfile.ToString(), (createProfileCmd) =>
|
app.Command(DisplayMagicianStartupAction.CreateProfile.ToString(), (createProfileCmd) =>
|
||||||
{
|
{
|
||||||
var argumentProfile = runProfileCmd.Argument("\"Profile_UUID\"", "(required) The UUID of the profile to run from those stored in the profile file.").IsRequired();
|
|
||||||
argumentProfile.Validators.Add(new ProfileMustExistValidator());
|
|
||||||
|
|
||||||
//description and help text of the command.
|
//description and help text of the command.
|
||||||
createProfileCmd.Description = "Use this command to go directly to the create display profile screen.";
|
createProfileCmd.Description = "Use this command to go directly to the create display profile screen.";
|
||||||
|
|
||||||
createProfileCmd.OnExecute(() =>
|
createProfileCmd.OnExecute(() =>
|
||||||
{
|
{
|
||||||
try
|
Console.WriteLine("Starting up and creating a new Display Profile...");
|
||||||
{
|
StartUpApplication(DisplayMagicianStartupAction.CreateProfile);
|
||||||
// Lookup the profile
|
return 0;
|
||||||
ProfileItem profileToUse = ProfileRepository.AllProfiles.Where(p => p.UUID.Equals(argumentProfile.Value)).First();
|
|
||||||
|
|
||||||
ApplyProfile(profileToUse);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -159,7 +147,7 @@ namespace DisplayMagician {
|
|||||||
{
|
{
|
||||||
|
|
||||||
Console.WriteLine("Starting Normally...");
|
Console.WriteLine("Starting Normally...");
|
||||||
StartUpNormally();
|
StartUpApplication();
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -188,7 +176,7 @@ namespace DisplayMagician {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StartUpNormally()
|
private static void StartUpApplication(DisplayMagicianStartupAction startupAction = DisplayMagicianStartupAction.StartUpNormally)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -280,8 +268,14 @@ namespace DisplayMagician {
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
Console.WriteLine($"Program/StartUpNormally exception 2: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCService.GetInstance().Status = InstanceStatus.User;
|
IPCService.GetInstance().Status = InstanceStatus.User;
|
||||||
Application.Run(new UIForms.MainForm());
|
|
||||||
|
// Run the program with normal startup
|
||||||
|
if (startupAction == DisplayMagicianStartupAction.StartUpNormally)
|
||||||
|
Application.Run(new MainForm());
|
||||||
|
else if (startupAction == DisplayMagicianStartupAction.CreateProfile)
|
||||||
|
Application.Run(new DisplayProfileForm());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -21,7 +21,7 @@ namespace DisplayMagician.UIForms
|
|||||||
private bool allowVisible; // ContextMenu's Show command used
|
private bool allowVisible; // ContextMenu's Show command used
|
||||||
private bool allowClose; // ContextMenu's Exit command used
|
private bool allowClose; // ContextMenu's Exit command used
|
||||||
|
|
||||||
public MainForm()
|
public MainForm(Form formToOpen = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
btn_setup_display_profiles.Parent = splitContainer1.Panel1;
|
btn_setup_display_profiles.Parent = splitContainer1.Panel1;
|
||||||
@ -52,6 +52,17 @@ namespace DisplayMagician.UIForms
|
|||||||
cb_minimise_notification_area.Checked = false;
|
cb_minimise_notification_area.Checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we've been handed a Form of some kind, then open it straight away
|
||||||
|
if (formToOpen is DisplayProfileForm)
|
||||||
|
{
|
||||||
|
var displayProfileForm = new DisplayProfileForm();
|
||||||
|
displayProfileForm.ShowDialog(this);
|
||||||
|
}
|
||||||
|
else if (formToOpen is ShortcutLibraryForm)
|
||||||
|
{
|
||||||
|
var shortcutLibraryForm = new ShortcutLibraryForm();
|
||||||
|
shortcutLibraryForm.ShowDialog(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user