mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
WIP] Adding audio volume to shortcut form
This commit is contained in:
parent
c5cb6e52f1
commit
0eb05639f6
@ -83,6 +83,8 @@ namespace DisplayMagician
|
||||
private bool _gameArgumentsRequired;
|
||||
private string _audioDevice;
|
||||
private bool _changeAudioDevice;
|
||||
private bool _setAudioVolume = false;
|
||||
private decimal _audioVolume = -1;
|
||||
private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary;
|
||||
private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary;
|
||||
private bool _autoName = true;
|
||||
@ -119,6 +121,7 @@ namespace DisplayMagician
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -133,8 +136,12 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -157,7 +164,8 @@ namespace DisplayMagician
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -170,6 +178,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -215,7 +228,8 @@ namespace DisplayMagician
|
||||
ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -238,6 +252,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -260,7 +279,8 @@ namespace DisplayMagician
|
||||
|
||||
public ShortcutItem(string name, ProfileItem profile, GameStruct game, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", decimal audioVolume = -1, 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))
|
||||
@ -279,6 +299,11 @@ namespace DisplayMagician
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -301,7 +326,8 @@ namespace DisplayMagician
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, GameStruct game, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -320,6 +346,11 @@ namespace DisplayMagician
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -363,7 +394,8 @@ namespace DisplayMagician
|
||||
ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -384,7 +416,12 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = false;
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -407,7 +444,8 @@ namespace DisplayMagician
|
||||
|
||||
public ShortcutItem(string name, ProfileItem profile, Executable executable, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -425,6 +463,11 @@ namespace DisplayMagician
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -446,7 +489,8 @@ namespace DisplayMagician
|
||||
|
||||
public ShortcutItem(string name, string profileUuid, Executable executable, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "") : this()
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "") : this()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -464,6 +508,11 @@ namespace DisplayMagician
|
||||
else
|
||||
_changeAudioDevice = true;
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -805,6 +854,31 @@ namespace DisplayMagician
|
||||
}
|
||||
}
|
||||
|
||||
public decimal AudioVolume
|
||||
{
|
||||
get
|
||||
{
|
||||
return _audioVolume;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_audioVolume = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetAudioVolume
|
||||
{
|
||||
get
|
||||
{
|
||||
return _setAudioVolume;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_setAudioVolume = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<StartProgram> StartPrograms
|
||||
{
|
||||
@ -898,7 +972,8 @@ namespace DisplayMagician
|
||||
ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -915,6 +990,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -938,7 +1018,8 @@ namespace DisplayMagician
|
||||
|
||||
public void UpdateNoGameShortcut(string name, string profileUuid, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -951,6 +1032,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -998,7 +1084,8 @@ namespace DisplayMagician
|
||||
ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -1021,6 +1108,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1044,7 +1136,8 @@ namespace DisplayMagician
|
||||
|
||||
public void UpdateGameShortcut(string name, ProfileItem profile, GameStruct game, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", decimal audioVolume = -1, 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))
|
||||
@ -1064,6 +1157,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1088,7 +1186,8 @@ namespace DisplayMagician
|
||||
|
||||
public void UpdateGameShortcut(string name, string profileUuid, GameStruct game, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -1108,6 +1207,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1153,7 +1257,8 @@ namespace DisplayMagician
|
||||
ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence,
|
||||
string originalIconPath,
|
||||
string audioDevice = "",
|
||||
string audioDevice = "",
|
||||
decimal audioVolume = -1,
|
||||
List<StartProgram> startPrograms = null,
|
||||
bool autoName = true,
|
||||
string uuid = ""
|
||||
@ -1176,6 +1281,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1199,7 +1309,8 @@ namespace DisplayMagician
|
||||
|
||||
public void UpdateExecutableShortcut(string name, ProfileItem profile, Executable executable, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -1218,6 +1329,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1241,7 +1357,8 @@ namespace DisplayMagician
|
||||
|
||||
public void UpdateExecutableShortcut(string name, string profileUuid, Executable executable, ShortcutPermanence displayPermanence,
|
||||
ShortcutPermanence audioPermanence, string originalIconPath,
|
||||
string audioDevice = "", List<StartProgram> startPrograms = null, bool autoName = true, string uuid = "")
|
||||
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null,
|
||||
bool autoName = true, string uuid = "")
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(uuid))
|
||||
_uuid = uuid;
|
||||
@ -1260,6 +1377,11 @@ namespace DisplayMagician
|
||||
_changeAudioDevice = true;
|
||||
|
||||
_audioDevice = audioDevice;
|
||||
if (audioVolume >= 0 && audioVolume <= 100)
|
||||
_setAudioVolume = true;
|
||||
else
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = audioVolume;
|
||||
_displayPermanence = displayPermanence;
|
||||
_audioPermanence = audioPermanence;
|
||||
_autoName = autoName;
|
||||
@ -1340,7 +1462,8 @@ namespace DisplayMagician
|
||||
shortcut.StartPrograms = StartPrograms;
|
||||
shortcut.ChangeAudioDevice = ChangeAudioDevice;
|
||||
shortcut.AudioDevice = AudioDevice;
|
||||
|
||||
shortcut.SetAudioVolume = SetAudioVolume;
|
||||
shortcut.AudioVolume = AudioVolume;
|
||||
// Save the shortcut incon to the icon cache
|
||||
shortcut.ReplaceShortcutIconInCache();
|
||||
|
||||
|
76
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
76
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
@ -122,6 +122,11 @@ namespace DisplayMagician.UIForms
|
||||
this.lbl_title = new System.Windows.Forms.Label();
|
||||
this.lbl_shortcut_name = new System.Windows.Forms.Label();
|
||||
this.cb_autosuggest = new System.Windows.Forms.CheckBox();
|
||||
this.gb_audio_volume = new System.Windows.Forms.GroupBox();
|
||||
this.rb_set_audio_volume = new System.Windows.Forms.RadioButton();
|
||||
this.rb_keep_audio_volume = new System.Windows.Forms.RadioButton();
|
||||
this.lbl_audio_volume = new System.Windows.Forms.Label();
|
||||
this.nud_audio_volume = new System.Windows.Forms.NumericUpDown();
|
||||
this.tabc_shortcut.SuspendLayout();
|
||||
this.tabp_display.SuspendLayout();
|
||||
this.tabp_audio.SuspendLayout();
|
||||
@ -138,6 +143,8 @@ namespace DisplayMagician.UIForms
|
||||
this.tabp_after.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.gb_display_after.SuspendLayout();
|
||||
this.gb_audio_volume.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_save
|
||||
@ -284,6 +291,7 @@ namespace DisplayMagician.UIForms
|
||||
// tabp_audio
|
||||
//
|
||||
this.tabp_audio.BackColor = System.Drawing.Color.Black;
|
||||
this.tabp_audio.Controls.Add(this.gb_audio_volume);
|
||||
this.tabp_audio.Controls.Add(this.btn_rescan_audio);
|
||||
this.tabp_audio.Controls.Add(this.cb_audio_device);
|
||||
this.tabp_audio.Controls.Add(this.rb_change_audio);
|
||||
@ -1201,6 +1209,66 @@ namespace DisplayMagician.UIForms
|
||||
this.cb_autosuggest.UseVisualStyleBackColor = true;
|
||||
this.cb_autosuggest.CheckedChanged += new System.EventHandler(this.cb_autosuggest_CheckedChanged);
|
||||
//
|
||||
// gb_audio_volume
|
||||
//
|
||||
this.gb_audio_volume.Controls.Add(this.rb_set_audio_volume);
|
||||
this.gb_audio_volume.Controls.Add(this.rb_keep_audio_volume);
|
||||
this.gb_audio_volume.Controls.Add(this.lbl_audio_volume);
|
||||
this.gb_audio_volume.Controls.Add(this.nud_audio_volume);
|
||||
this.gb_audio_volume.Location = new System.Drawing.Point(392, 240);
|
||||
this.gb_audio_volume.Name = "gb_audio_volume";
|
||||
this.gb_audio_volume.Size = new System.Drawing.Size(506, 147);
|
||||
this.gb_audio_volume.TabIndex = 10;
|
||||
this.gb_audio_volume.TabStop = false;
|
||||
//
|
||||
// rb_set_audio_volume
|
||||
//
|
||||
this.rb_set_audio_volume.AutoSize = true;
|
||||
this.rb_set_audio_volume.Enabled = false;
|
||||
this.rb_set_audio_volume.ForeColor = System.Drawing.Color.White;
|
||||
this.rb_set_audio_volume.Location = new System.Drawing.Point(38, 84);
|
||||
this.rb_set_audio_volume.Name = "rb_set_audio_volume";
|
||||
this.rb_set_audio_volume.Size = new System.Drawing.Size(167, 24);
|
||||
this.rb_set_audio_volume.TabIndex = 13;
|
||||
this.rb_set_audio_volume.Text = "Set audio volume at";
|
||||
this.rb_set_audio_volume.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// rb_keep_audio_volume
|
||||
//
|
||||
this.rb_keep_audio_volume.AutoSize = true;
|
||||
this.rb_keep_audio_volume.Enabled = false;
|
||||
this.rb_keep_audio_volume.ForeColor = System.Drawing.Color.White;
|
||||
this.rb_keep_audio_volume.Location = new System.Drawing.Point(38, 36);
|
||||
this.rb_keep_audio_volume.Name = "rb_keep_audio_volume";
|
||||
this.rb_keep_audio_volume.Size = new System.Drawing.Size(203, 24);
|
||||
this.rb_keep_audio_volume.TabIndex = 12;
|
||||
this.rb_keep_audio_volume.Text = "Leave audio volume as is";
|
||||
this.rb_keep_audio_volume.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lbl_audio_volume
|
||||
//
|
||||
this.lbl_audio_volume.AutoSize = true;
|
||||
this.lbl_audio_volume.Enabled = false;
|
||||
this.lbl_audio_volume.ForeColor = System.Drawing.Color.White;
|
||||
this.lbl_audio_volume.Location = new System.Drawing.Point(275, 86);
|
||||
this.lbl_audio_volume.Name = "lbl_audio_volume";
|
||||
this.lbl_audio_volume.Size = new System.Drawing.Size(63, 20);
|
||||
this.lbl_audio_volume.TabIndex = 11;
|
||||
this.lbl_audio_volume.Text = "percent";
|
||||
//
|
||||
// nud_audio_volume
|
||||
//
|
||||
this.nud_audio_volume.Enabled = false;
|
||||
this.nud_audio_volume.Location = new System.Drawing.Point(209, 84);
|
||||
this.nud_audio_volume.Name = "nud_audio_volume";
|
||||
this.nud_audio_volume.Size = new System.Drawing.Size(60, 26);
|
||||
this.nud_audio_volume.TabIndex = 10;
|
||||
this.nud_audio_volume.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// ShortcutForm
|
||||
//
|
||||
this.AcceptButton = this.btn_save;
|
||||
@ -1253,6 +1321,9 @@ namespace DisplayMagician.UIForms
|
||||
this.groupBox1.PerformLayout();
|
||||
this.gb_display_after.ResumeLayout(false);
|
||||
this.gb_display_after.PerformLayout();
|
||||
this.gb_audio_volume.ResumeLayout(false);
|
||||
this.gb_audio_volume.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -1348,5 +1419,10 @@ namespace DisplayMagician.UIForms
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.RadioButton rb_switch_audio_permanent;
|
||||
private System.Windows.Forms.RadioButton rb_switch_audio_temp;
|
||||
private System.Windows.Forms.GroupBox gb_audio_volume;
|
||||
private System.Windows.Forms.RadioButton rb_set_audio_volume;
|
||||
private System.Windows.Forms.RadioButton rb_keep_audio_volume;
|
||||
private System.Windows.Forms.Label lbl_audio_volume;
|
||||
private System.Windows.Forms.NumericUpDown nud_audio_volume;
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@ namespace DisplayMagician.UIForms
|
||||
List<StartProgram> _startPrograms = new List<StartProgram>();
|
||||
private string _audioDevice = "";
|
||||
private bool _changeAudioDevice = false;
|
||||
private bool _setAudioVolume = false;
|
||||
private decimal _audioVolume = -1;
|
||||
private ShortcutItem _shortcutToEdit = null;
|
||||
List<Game> allGames = new List<Game>();
|
||||
private bool _isUnsaved = true;
|
||||
@ -366,6 +368,17 @@ namespace DisplayMagician.UIForms
|
||||
else
|
||||
_changeAudioDevice = false;
|
||||
|
||||
if (rb_set_audio_volume.Checked)
|
||||
{
|
||||
_setAudioVolume = true;
|
||||
_audioVolume = nud_audio_volume.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_setAudioVolume = false;
|
||||
_audioVolume = -1;
|
||||
}
|
||||
|
||||
// Check the audio permanence requirements
|
||||
if (rb_switch_audio_temp.Checked)
|
||||
_audioPermanence = ShortcutPermanence.Temporary;
|
||||
@ -439,6 +452,7 @@ namespace DisplayMagician.UIForms
|
||||
_audioPermanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_audioDevice,
|
||||
_audioVolume,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
@ -463,6 +477,7 @@ namespace DisplayMagician.UIForms
|
||||
_audioPermanence,
|
||||
_gameToUse.GameToPlay.IconPath,
|
||||
_audioDevice,
|
||||
_audioVolume,
|
||||
_startPrograms,
|
||||
_autoName,
|
||||
_uuid
|
||||
@ -496,6 +511,7 @@ namespace DisplayMagician.UIForms
|
||||
_audioPermanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_audioDevice,
|
||||
_audioVolume,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
);
|
||||
@ -511,6 +527,7 @@ namespace DisplayMagician.UIForms
|
||||
_audioPermanence,
|
||||
_executableToUse.ExecutableNameAndPath,
|
||||
_audioDevice,
|
||||
_audioVolume,
|
||||
_startPrograms,
|
||||
_autoName
|
||||
);
|
||||
@ -862,10 +879,36 @@ namespace DisplayMagician.UIForms
|
||||
cb_audio_device.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the launcher items if we have them
|
||||
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString();
|
||||
if (_shortcutToEdit.SetAudioVolume)
|
||||
{
|
||||
if (_shortcutToEdit.AudioVolume >= 0 && _shortcutToEdit.AudioVolume <= 100)
|
||||
{
|
||||
nud_audio_volume.Value = _shortcutToEdit.AudioVolume;
|
||||
rb_set_audio_volume.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool foundVolumeDevice = false;
|
||||
foreach (CoreAudioDevice audioDevice in audioDevices)
|
||||
{
|
||||
if (audioDevice.State == AudioSwitcher.AudioApi.DeviceState.Active &&
|
||||
audioDevice.FullName.Equals(_shortcutToEdit.AudioDevice))
|
||||
{
|
||||
nud_audio_volume.Value = Convert.ToDecimal(audioDevice.Volume);
|
||||
foundVolumeDevice = true;
|
||||
}
|
||||
}
|
||||
if (foundVolumeDevice)
|
||||
nud_audio_volume.Value = _shortcutToEdit.AudioVolume;
|
||||
else
|
||||
nud_audio_volume.Value = 100;
|
||||
rb_set_audio_volume.Checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
// Set the launcher items if we have them
|
||||
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString();
|
||||
txt_game_name.Text = _shortcutToEdit.GameName;
|
||||
_gameId = _shortcutToEdit.GameAppId;
|
||||
nud_timeout_game.Value = _shortcutToEdit.StartTimeout;
|
||||
@ -1472,6 +1515,15 @@ namespace DisplayMagician.UIForms
|
||||
_isUnsaved = true;
|
||||
cb_audio_device.Enabled = false;
|
||||
btn_rescan_audio.Enabled = false;
|
||||
rb_set_audio_volume.Visible = false;
|
||||
rb_keep_audio_volume.Visible = false;
|
||||
nud_audio_volume.Visible = false;
|
||||
lbl_audio_volume.Visible = false;
|
||||
rb_set_audio_volume.Enabled = false;
|
||||
rb_keep_audio_volume.Enabled = false;
|
||||
nud_audio_volume.Enabled = false;
|
||||
lbl_audio_volume.Enabled = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1483,6 +1535,14 @@ namespace DisplayMagician.UIForms
|
||||
_isUnsaved = true;
|
||||
cb_audio_device.Enabled = true;
|
||||
btn_rescan_audio.Enabled = true;
|
||||
rb_set_audio_volume.Visible = true;
|
||||
rb_keep_audio_volume.Visible = true;
|
||||
nud_audio_volume.Visible = true;
|
||||
lbl_audio_volume.Visible = true;
|
||||
rb_set_audio_volume.Enabled = true;
|
||||
rb_keep_audio_volume.Enabled = true;
|
||||
nud_audio_volume.Enabled = false;
|
||||
lbl_audio_volume.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1531,5 +1591,19 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
}
|
||||
|
||||
private void rb_keep_audio_volume_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_loadedShortcut)
|
||||
_isUnsaved = true;
|
||||
nud_audio_volume.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
private void rb_set_audio_volume_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_loadedShortcut)
|
||||
_isUnsaved = true;
|
||||
nud_audio_volume.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user