mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Added audiodevice logic to save it
Added the ability to store the audio device information within the ShortcutItem, and also added the logic to the ShortcutForm to correctly load and save the audio device settings. Also coped with the edge case of when an audio device is turned off or unplugged when the user edits the shortcut... in that case we want to still keep the old audio device settings as it is likely to be plugged back in when the shortcut is actually run.
This commit is contained in:
parent
e44c2d045b
commit
eb93e84e22
@ -80,6 +80,8 @@ namespace DisplayMagician
|
||||
private uint _startTimeout;
|
||||
private string _gameArguments;
|
||||
private bool _gameArgumentsRequired;
|
||||
private string _audioDevice;
|
||||
private bool _changeAudioDevice;
|
||||
private ShortcutPermanence _permanence = ShortcutPermanence.Temporary;
|
||||
private bool _autoName = true;
|
||||
private bool _isPossible;
|
||||
@ -114,6 +116,7 @@ namespace DisplayMagician
|
||||
ProfileItem profile,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -124,6 +127,12 @@ namespace DisplayMagician
|
||||
_name = name;
|
||||
_category = ShortcutCategory.NoGame;
|
||||
_profileToUse = profile;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -144,13 +153,19 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
_name = name;
|
||||
_profileUuid = profileUuid;
|
||||
_category = ShortcutCategory.NoGame;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -194,6 +209,7 @@ namespace DisplayMagician
|
||||
bool gameArgumentsRequired,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -210,6 +226,12 @@ namespace DisplayMagician
|
||||
_startTimeout = gameTimeout;
|
||||
_gameArguments = gameArguments;
|
||||
_gameArgumentsRequired = gameArgumentsRequired;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -230,7 +252,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public ShortcutItem(string name, ProfileItem profile, GameStruct game, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
// Create a new UUID for the shortcut if one wasn't created already
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
@ -244,6 +266,11 @@ namespace DisplayMagician
|
||||
_startTimeout = game.StartTimeout;
|
||||
_gameArguments = game.GameArguments;
|
||||
_gameArgumentsRequired = game.GameArgumentsRequired;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -264,7 +291,7 @@ namespace DisplayMagician
|
||||
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, GameStruct game, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -278,6 +305,11 @@ namespace DisplayMagician
|
||||
_gameArguments = game.GameArguments;
|
||||
_gameArgumentsRequired = game.GameArgumentsRequired;
|
||||
_gameArgumentsRequired = false;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -319,6 +351,7 @@ namespace DisplayMagician
|
||||
bool processNameToMonitorUsesExecutable,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -335,6 +368,11 @@ namespace DisplayMagician
|
||||
_executableArguments = executableArguments;
|
||||
_executableArgumentsRequired = executableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -355,7 +393,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public ShortcutItem(string name, ProfileItem profile, Executable executable, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -368,6 +406,11 @@ namespace DisplayMagician
|
||||
_executableArguments = executable.ExecutableArguments;
|
||||
_executableArgumentsRequired = executable.ExecutableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -387,7 +430,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, Executable executable, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -400,6 +443,11 @@ namespace DisplayMagician
|
||||
_executableArguments = executable.ExecutableArguments;
|
||||
_executableArgumentsRequired = executable.ExecutableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -701,6 +749,33 @@ namespace DisplayMagician
|
||||
}
|
||||
}
|
||||
|
||||
public string AudioDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
return _audioDevice;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_audioDevice = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ChangeAudioDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
return _changeAudioDevice;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_changeAudioDevice = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<StartProgram> StartPrograms
|
||||
{
|
||||
get
|
||||
@ -792,6 +867,7 @@ namespace DisplayMagician
|
||||
ProfileItem profile,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -802,6 +878,12 @@ namespace DisplayMagician
|
||||
_name = name;
|
||||
_category = ShortcutCategory.NoGame;
|
||||
_profileToUse = profile;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -823,13 +905,19 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public void UpdateNoGameShortcut(string name, string profileUuid, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
_name = name;
|
||||
_profileUuid = profileUuid;
|
||||
_category = ShortcutCategory.NoGame;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -875,6 +963,7 @@ namespace DisplayMagician
|
||||
bool gameArgumentsRequired,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -891,6 +980,12 @@ namespace DisplayMagician
|
||||
_startTimeout = gameTimeout;
|
||||
_gameArguments = gameArguments;
|
||||
_gameArgumentsRequired = gameArgumentsRequired;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -912,7 +1007,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public void UpdateGameShortcut(string name, ProfileItem profile, GameStruct game, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
{
|
||||
// Create a new UUID for the shortcut if one wasn't created already
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
@ -926,6 +1021,12 @@ namespace DisplayMagician
|
||||
_startTimeout = game.StartTimeout;
|
||||
_gameArguments = game.GameArguments;
|
||||
_gameArgumentsRequired = game.GameArgumentsRequired;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -948,7 +1049,7 @@ namespace DisplayMagician
|
||||
|
||||
|
||||
public void UpdateGameShortcut(string name, string profileUuid, GameStruct game, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -962,6 +1063,12 @@ namespace DisplayMagician
|
||||
_gameArguments = game.GameArguments;
|
||||
_gameArgumentsRequired = game.GameArgumentsRequired;
|
||||
_gameArgumentsRequired = false;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -1005,6 +1112,7 @@ namespace DisplayMagician
|
||||
bool processNameToMonitorUsesExecutable,
|
||||
ShortcutPermanence permanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -1021,6 +1129,12 @@ namespace DisplayMagician
|
||||
_executableArguments = executableArguments;
|
||||
_executableArgumentsRequired = executableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -1042,7 +1156,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public void UpdateExecutableShortcut(string name, ProfileItem profile, Executable executable, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -1055,6 +1169,12 @@ namespace DisplayMagician
|
||||
_executableArguments = executable.ExecutableArguments;
|
||||
_executableArgumentsRequired = executable.ExecutableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -1076,7 +1196,7 @@ namespace DisplayMagician
|
||||
}
|
||||
|
||||
public void UpdateExecutableShortcut(string name, string profileUuid, Executable executable, ShortcutPermanence permanence, string originalIconPath,
|
||||
List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -1089,6 +1209,12 @@ namespace DisplayMagician
|
||||
_executableArguments = executable.ExecutableArguments;
|
||||
_executableArgumentsRequired = executable.ExecutableArgumentsRequired;
|
||||
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
|
||||
if (String.IsNullOrEmpty(audioDevice))
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_permanence = permanence;
|
||||
_autoName = autoName;
|
||||
_startPrograms = startPrograms;
|
||||
@ -1165,6 +1291,8 @@ namespace DisplayMagician
|
||||
shortcut.SavedShortcutIconCacheFilename = SavedShortcutIconCacheFilename;
|
||||
shortcut.IsPossible = IsPossible;
|
||||
shortcut.StartPrograms = StartPrograms;
|
||||
shortcut.ChangeAudioDevice = ChangeAudioDevice;
|
||||
shortcut.AudioDevice = AudioDevice;
|
||||
|
||||
// Save the shortcut incon to the icon cache
|
||||
shortcut.ReplaceShortcutIconInCache();
|
||||
|
@ -10840,7 +10840,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="btn_exit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>698, 355</value>
|
||||
<value>700, 352</value>
|
||||
</data>
|
||||
<data name="btn_exit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
|
@ -27,6 +27,8 @@ namespace DisplayMagician.UIForms
|
||||
private Executable _executableToUse;
|
||||
private ShortcutPermanence _permanence = ShortcutPermanence.Temporary;
|
||||
List<StartProgram> _startPrograms = new List<StartProgram>();
|
||||
private string _audioDevice = "";
|
||||
private bool _changeAudioDevice = false;
|
||||
private ShortcutItem _shortcutToEdit = null;
|
||||
List<Game> allGames = new List<Game>();
|
||||
private bool _isUnsaved = true;
|
||||
@ -256,17 +258,6 @@ namespace DisplayMagician.UIForms
|
||||
return;
|
||||
}
|
||||
|
||||
/*// Please use a plain name that can be
|
||||
if (ShortcutRepository.ContainsShortcut(txt_shortcut_save_name.Text))
|
||||
{
|
||||
MessageBox.Show(
|
||||
@"A shortcut has already been created with this name. Please enter a different name for this shortcut.",
|
||||
@"Please rename this Shortcut.",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Check the profile is set and that it's still valid
|
||||
if (!(_profileToUse is ProfileItem))
|
||||
{
|
||||
@ -365,6 +356,15 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
}
|
||||
|
||||
// Save the Audio features
|
||||
if (rb_change_audio.Checked)
|
||||
{
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = cb_audio_device.Text;
|
||||
}
|
||||
else
|
||||
_changeAudioDevice = false;
|
||||
|
||||
|
||||
|
||||
// Check the permanence requirements
|
||||
@ -425,22 +425,13 @@ namespace DisplayMagician.UIForms
|
||||
_gameToUse.GameArguments = txt_args_game.Text;
|
||||
_gameToUse.GameArgumentsRequired = cb_args_game.Checked;
|
||||
|
||||
/* _shortcutToEdit = new ShortcutItem(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_gameToUse,
|
||||
_permanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
);*/
|
||||
_shortcutToEdit.UpdateGameShortcut(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_gameToUse,
|
||||
_permanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_audioDevice,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
@ -457,22 +448,13 @@ namespace DisplayMagician.UIForms
|
||||
_gameToUse.GameArguments = txt_args_game.Text;
|
||||
_gameToUse.GameArgumentsRequired = cb_args_game.Checked;
|
||||
|
||||
/*_shortcutToEdit = new ShortcutItem(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_gameToUse,
|
||||
_permanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
);*/
|
||||
_shortcutToEdit.UpdateGameShortcut(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_gameToUse,
|
||||
_permanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_audioDevice,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
@ -498,21 +480,13 @@ namespace DisplayMagician.UIForms
|
||||
_executableToUse.ProcessNameToMonitorUsesExecutable = true;
|
||||
}
|
||||
|
||||
/*_shortcutToEdit = new ShortcutItem(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_executableToUse,
|
||||
_permanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
);*/
|
||||
_shortcutToEdit.UpdateExecutableShortcut(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_executableToUse,
|
||||
_permanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_audioDevice,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
);
|
||||
@ -521,20 +495,12 @@ namespace DisplayMagician.UIForms
|
||||
else
|
||||
{
|
||||
|
||||
/* _shortcutToEdit = new ShortcutItem(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_permanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
|
||||
);
|
||||
*/ _shortcutToEdit.UpdateNoGameShortcut(
|
||||
_shortcutToEdit.UpdateNoGameShortcut(
|
||||
txt_shortcut_save_name.Text,
|
||||
_profileToUse,
|
||||
_permanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_audioDevice,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
);
|
||||
@ -714,6 +680,7 @@ namespace DisplayMagician.UIForms
|
||||
if (audioDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
|
||||
{
|
||||
int index = cb_audio_device.Items.Add(audioDevice.FullName);
|
||||
// Set the audio device to the default device by default
|
||||
if (audioDevice.IsDefaultDevice)
|
||||
cb_audio_device.SelectedIndex = index;
|
||||
}
|
||||
@ -821,17 +788,6 @@ namespace DisplayMagician.UIForms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If it is a new Shortcut then we don't have to load anything!
|
||||
//if (_isNewShortcut)
|
||||
//{
|
||||
// RefreshShortcutUI();
|
||||
// ChangeSelectedProfile(ProfileRepository.CurrentProfile);
|
||||
// _isUnsaved = true;
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
// Now start populating the other fields if they need it
|
||||
_uuid = _shortcutToEdit.UUID;
|
||||
|
||||
@ -859,6 +815,35 @@ namespace DisplayMagician.UIForms
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the Audio device to the shortcut audio device only if
|
||||
// the Change Audio radiobutton is set
|
||||
rb_change_audio.Checked = _shortcutToEdit.ChangeAudioDevice;
|
||||
if (_shortcutToEdit.ChangeAudioDevice)
|
||||
{
|
||||
bool foundAudioDevice = false;
|
||||
for (int i = 0; i < cb_audio_device.Items.Count; i++)
|
||||
{
|
||||
if (cb_audio_device.Items[i].Equals(_shortcutToEdit.AudioDevice))
|
||||
{
|
||||
cb_audio_device.SelectedIndex = i;
|
||||
foundAudioDevice = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// If we have a saved Audio device which isn't plugged in
|
||||
// or isn't turned on right now, we don't want to lose the
|
||||
// information, as the user has specifically set that audio device
|
||||
// and they may plug it in when it comes time to use the shortcut
|
||||
// So we add the audiodevice as an extra selection in this case.
|
||||
if (!foundAudioDevice)
|
||||
{
|
||||
int index = cb_audio_device.Items.Add(_shortcutToEdit.AudioDevice);
|
||||
cb_audio_device.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the launcher items if we have them
|
||||
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString();
|
||||
txt_game_name.Text = _shortcutToEdit.GameName;
|
||||
@ -1502,6 +1487,28 @@ namespace DisplayMagician.UIForms
|
||||
}
|
||||
}
|
||||
|
||||
bool foundAudioDevice = false;
|
||||
for (int i = 0; i < cb_audio_device.Items.Count; i++)
|
||||
{
|
||||
if (cb_audio_device.Items[i].Equals(_shortcutToEdit.AudioDevice))
|
||||
{
|
||||
cb_audio_device.SelectedIndex = i;
|
||||
foundAudioDevice = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// If we have a saved Audio device which isn't plugged in
|
||||
// or isn't turned on right now, we don't want to lose the
|
||||
// information, as the user has specifically set that audio device
|
||||
// and they may plug it in when it comes time to use the shortcut
|
||||
// So we add the audiodevice as an extra selection in this case.
|
||||
if (!foundAudioDevice)
|
||||
{
|
||||
int index = cb_audio_device.Items.Add(_shortcutToEdit.AudioDevice);
|
||||
cb_audio_device.SelectedIndex = index;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user