mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Additional stop program settings.
This commit is contained in:
parent
fb482030e2
commit
6febe82c2f
@ -61,6 +61,18 @@ namespace DisplayMagician
|
||||
public bool DontStartIfAlreadyRunning;
|
||||
}
|
||||
|
||||
public struct StopProgram
|
||||
{
|
||||
public int Priority;
|
||||
public bool Disabled;
|
||||
public ProcessPriority ProcessPriority;
|
||||
public string Executable;
|
||||
public string Arguments;
|
||||
public bool ExecutableArgumentsRequired;
|
||||
public bool CloseOnFinish;
|
||||
public bool DontStartIfAlreadyRunning;
|
||||
}
|
||||
|
||||
public struct Executable
|
||||
{
|
||||
public string DifferentExecutableToMonitor;
|
||||
@ -139,6 +151,7 @@ namespace DisplayMagician
|
||||
private ShortcutValidity _isValid;
|
||||
private List<ShortcutError> _shortcutErrors = new List<ShortcutError>();
|
||||
private List<StartProgram> _startPrograms;
|
||||
private List<StopProgram> _stopPrograms;
|
||||
private Bitmap _shortcutBitmap, _originalBitmap;
|
||||
[JsonIgnore]
|
||||
#pragma warning disable CS3008 // Identifier is not CLS-compliant
|
||||
@ -641,6 +654,20 @@ namespace DisplayMagician
|
||||
}
|
||||
}
|
||||
|
||||
public List<StopProgram> StopPrograms
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stopPrograms;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_stopPrograms = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string OriginalIconPath {
|
||||
get
|
||||
{
|
||||
@ -788,6 +815,7 @@ namespace DisplayMagician
|
||||
bool setCaptureVolume = false,
|
||||
decimal captureVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
List<StopProgram> stopPrograms = null,
|
||||
bool autoName = true,
|
||||
Keys hotkey = Keys.None,
|
||||
string uuid = ""
|
||||
@ -844,6 +872,7 @@ namespace DisplayMagician
|
||||
bool setCaptureVolume = false,
|
||||
decimal captureVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
List<StopProgram> stopPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = "",
|
||||
Keys hotkey = Keys.None
|
||||
@ -877,6 +906,7 @@ namespace DisplayMagician
|
||||
_capturePermanence = capturePermanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
_stopPrograms = stopPrograms;
|
||||
_originalIconPath = originalIconPath;
|
||||
_userChoseOwnIcon = userChoseOwnIcon;
|
||||
_availableImages = availableImages;
|
||||
@ -913,6 +943,7 @@ namespace DisplayMagician
|
||||
bool setCaptureVolume = false,
|
||||
decimal captureVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
List<StopProgram> stopPrograms = null,
|
||||
bool autoName = true,
|
||||
Keys hotkey = Keys.None,
|
||||
string uuid = ""
|
||||
@ -943,6 +974,7 @@ namespace DisplayMagician
|
||||
_capturePermanence = capturePermanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
_stopPrograms = stopPrograms;
|
||||
_originalIconPath = originalIconPath;
|
||||
_userChoseOwnIcon = userChoseOwnIcon;
|
||||
_availableImages = availableImages;
|
||||
@ -995,6 +1027,7 @@ namespace DisplayMagician
|
||||
shortcut.IsValid = IsValid;
|
||||
shortcut.Errors.AddRange(Errors);
|
||||
shortcut.StartPrograms = StartPrograms;
|
||||
shortcut.StopPrograms = StopPrograms;
|
||||
shortcut.ChangeAudioDevice = ChangeAudioDevice;
|
||||
shortcut.AudioDevice = AudioDevice;
|
||||
shortcut.SetAudioVolume = SetAudioVolume;
|
||||
|
@ -36,6 +36,7 @@ namespace DisplayMagician.UIForms
|
||||
private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary;
|
||||
private ShortcutPermanence _capturePermanence = ShortcutPermanence.Temporary;
|
||||
List<StartProgram> _startPrograms = new List<StartProgram>();
|
||||
List<StopProgram> _stopPrograms = new List<StopProgram>();
|
||||
private string _audioDevice = "";
|
||||
private bool _changeAudioDevice = false;
|
||||
private bool _setAudioVolume = false;
|
||||
@ -497,6 +498,22 @@ namespace DisplayMagician.UIForms
|
||||
// Replace the old start programs with the ones we've created now
|
||||
_startPrograms = newStartPrograms;
|
||||
|
||||
// Store the single stop program if it's set (but wth lots of defaults)
|
||||
if (!String.IsNullOrWhiteSpace(txt_run_cmd_afterwards.Text) && File.Exists(txt_run_cmd_afterwards.Text))
|
||||
{
|
||||
_stopPrograms = new List<StopProgram>();
|
||||
StopProgram stopProgram = new StopProgram();
|
||||
stopProgram.Executable = txt_run_cmd_afterwards.Text;
|
||||
stopProgram.Priority = 0;
|
||||
stopProgram.DontStartIfAlreadyRunning = false;
|
||||
stopProgram.Arguments = "";
|
||||
stopProgram.Disabled = false;
|
||||
stopProgram.ExecutableArgumentsRequired = false;
|
||||
stopProgram.ProcessPriority = ProcessPriority.Normal;
|
||||
_stopPrograms.Add(stopProgram);
|
||||
}
|
||||
|
||||
|
||||
// Now we create the Shortcut Object ready to save
|
||||
// If we're launching a game
|
||||
if (rb_launcher.Checked)
|
||||
@ -580,6 +597,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_uuid,
|
||||
_hotkey
|
||||
@ -606,6 +624,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_uuid,
|
||||
_hotkey
|
||||
@ -657,6 +676,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_hotkey
|
||||
);
|
||||
@ -682,6 +702,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_hotkey
|
||||
);
|
||||
@ -709,6 +730,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_hotkey
|
||||
);
|
||||
@ -731,6 +753,7 @@ namespace DisplayMagician.UIForms
|
||||
_setCaptureVolume,
|
||||
_captureVolume,
|
||||
_startPrograms,
|
||||
_stopPrograms,
|
||||
_autoName,
|
||||
_hotkey
|
||||
);
|
||||
@ -1429,6 +1452,12 @@ namespace DisplayMagician.UIForms
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the single stop program we're beginning with
|
||||
if (_shortcutToEdit.StopPrograms is List<StopProgram> && _shortcutToEdit.StopPrograms.Count > 0)
|
||||
{
|
||||
txt_run_cmd_afterwards.Text = _shortcutToEdit.StopPrograms[0].Executable;
|
||||
}
|
||||
|
||||
// Refresh the Shortcut UI
|
||||
RefreshShortcutUI();
|
||||
ChangeSelectedProfile(chosenProfile);
|
||||
|
Loading…
Reference in New Issue
Block a user