mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed profile selection for Shortcuts
Fixed the logic for profile selection on shortcuts so that the profile is either selected or not based on its existence or whether the profile is valid to use now or whether the shortcut is new.
This commit is contained in:
parent
5260d8a087
commit
79597b077f
@ -608,7 +608,9 @@ namespace DisplayMagician
|
|||||||
// record the old audio device
|
// record the old audio device
|
||||||
bool needToChangeAudio = false;
|
bool needToChangeAudio = false;
|
||||||
CoreAudioDevice rollbackAudioDevice = _audioController.DefaultPlaybackDevice;
|
CoreAudioDevice rollbackAudioDevice = _audioController.DefaultPlaybackDevice;
|
||||||
double rollbackAudioVolume = _audioController.DefaultPlaybackDevice.Volume;
|
double rollbackAudioVolume = 50;
|
||||||
|
if (rollbackAudioDevice != null)
|
||||||
|
rollbackAudioVolume = _audioController.DefaultPlaybackDevice.Volume;
|
||||||
if (!rollbackAudioDevice.FullName.Equals(shortcutToUse.AudioDevice))
|
if (!rollbackAudioDevice.FullName.Equals(shortcutToUse.AudioDevice))
|
||||||
{
|
{
|
||||||
logger.Debug($"ShortcutRepository/RunShortcut: We need to change to the {shortcutToUse.AudioDevice} audio device.");
|
logger.Debug($"ShortcutRepository/RunShortcut: We need to change to the {shortcutToUse.AudioDevice} audio device.");
|
||||||
@ -650,7 +652,9 @@ namespace DisplayMagician
|
|||||||
// record the old microphone device
|
// record the old microphone device
|
||||||
bool needToChangeCaptureDevice = false;
|
bool needToChangeCaptureDevice = false;
|
||||||
CoreAudioDevice rollbackCaptureDevice = _audioController.DefaultCaptureDevice;
|
CoreAudioDevice rollbackCaptureDevice = _audioController.DefaultCaptureDevice;
|
||||||
double rollbackCaptureVolume = _audioController.DefaultCaptureDevice.Volume;
|
double rollbackCaptureVolume = 50;
|
||||||
|
if (rollbackCaptureDevice != null)
|
||||||
|
rollbackCaptureVolume = _audioController.DefaultCaptureDevice.Volume;
|
||||||
if (!rollbackCaptureDevice.FullName.Equals(shortcutToUse.CaptureDevice))
|
if (!rollbackCaptureDevice.FullName.Equals(shortcutToUse.CaptureDevice))
|
||||||
{
|
{
|
||||||
logger.Debug($"ShortcutRepository/RunShortcut: We need to change to the {shortcutToUse.CaptureDevice} capture (microphone) device.");
|
logger.Debug($"ShortcutRepository/RunShortcut: We need to change to the {shortcutToUse.CaptureDevice} capture (microphone) device.");
|
||||||
|
17
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
17
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
@ -260,10 +260,9 @@ namespace DisplayMagician.UIForms
|
|||||||
this.lbl_profile_shown_subtitle.ForeColor = System.Drawing.Color.White;
|
this.lbl_profile_shown_subtitle.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_profile_shown_subtitle.Location = new System.Drawing.Point(18, 49);
|
this.lbl_profile_shown_subtitle.Location = new System.Drawing.Point(18, 49);
|
||||||
this.lbl_profile_shown_subtitle.Name = "lbl_profile_shown_subtitle";
|
this.lbl_profile_shown_subtitle.Name = "lbl_profile_shown_subtitle";
|
||||||
this.lbl_profile_shown_subtitle.Size = new System.Drawing.Size(943, 20);
|
this.lbl_profile_shown_subtitle.Size = new System.Drawing.Size(397, 20);
|
||||||
this.lbl_profile_shown_subtitle.TabIndex = 26;
|
this.lbl_profile_shown_subtitle.TabIndex = 26;
|
||||||
this.lbl_profile_shown_subtitle.Text = "Please go back to the startup window, click on the \'Setup Display Profile\' button" +
|
this.lbl_profile_shown_subtitle.Text = "Please select a Display Profile to use with this Shortcut.";
|
||||||
", save a new Display Profile and then come back here.";
|
|
||||||
//
|
//
|
||||||
// lbl_profile_shown
|
// lbl_profile_shown
|
||||||
//
|
//
|
||||||
@ -273,9 +272,9 @@ namespace DisplayMagician.UIForms
|
|||||||
this.lbl_profile_shown.ForeColor = System.Drawing.Color.White;
|
this.lbl_profile_shown.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_profile_shown.Location = new System.Drawing.Point(18, 20);
|
this.lbl_profile_shown.Location = new System.Drawing.Point(18, 20);
|
||||||
this.lbl_profile_shown.Name = "lbl_profile_shown";
|
this.lbl_profile_shown.Name = "lbl_profile_shown";
|
||||||
this.lbl_profile_shown.Size = new System.Drawing.Size(396, 29);
|
this.lbl_profile_shown.Size = new System.Drawing.Size(308, 29);
|
||||||
this.lbl_profile_shown.TabIndex = 25;
|
this.lbl_profile_shown.TabIndex = 25;
|
||||||
this.lbl_profile_shown.Text = "No Saved Display Profiles Available";
|
this.lbl_profile_shown.Text = "No Display Profile Selected";
|
||||||
//
|
//
|
||||||
// ilv_saved_profiles
|
// ilv_saved_profiles
|
||||||
//
|
//
|
||||||
@ -323,7 +322,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.tabp_audio.Location = new System.Drawing.Point(4, 32);
|
this.tabp_audio.Location = new System.Drawing.Point(4, 32);
|
||||||
this.tabp_audio.Name = "tabp_audio";
|
this.tabp_audio.Name = "tabp_audio";
|
||||||
this.tabp_audio.Padding = new System.Windows.Forms.Padding(3);
|
this.tabp_audio.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabp_audio.Size = new System.Drawing.Size(1082, 594);
|
this.tabp_audio.Size = new System.Drawing.Size(1082, 618);
|
||||||
this.tabp_audio.TabIndex = 4;
|
this.tabp_audio.TabIndex = 4;
|
||||||
this.tabp_audio.Text = "2. Choose Audio";
|
this.tabp_audio.Text = "2. Choose Audio";
|
||||||
//
|
//
|
||||||
@ -601,7 +600,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.tabp_before.Location = new System.Drawing.Point(4, 32);
|
this.tabp_before.Location = new System.Drawing.Point(4, 32);
|
||||||
this.tabp_before.Name = "tabp_before";
|
this.tabp_before.Name = "tabp_before";
|
||||||
this.tabp_before.Padding = new System.Windows.Forms.Padding(3);
|
this.tabp_before.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabp_before.Size = new System.Drawing.Size(1082, 594);
|
this.tabp_before.Size = new System.Drawing.Size(1082, 618);
|
||||||
this.tabp_before.TabIndex = 1;
|
this.tabp_before.TabIndex = 1;
|
||||||
this.tabp_before.Text = "3. Choose what happens before";
|
this.tabp_before.Text = "3. Choose what happens before";
|
||||||
//
|
//
|
||||||
@ -971,7 +970,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.tabp_game.Location = new System.Drawing.Point(4, 32);
|
this.tabp_game.Location = new System.Drawing.Point(4, 32);
|
||||||
this.tabp_game.Name = "tabp_game";
|
this.tabp_game.Name = "tabp_game";
|
||||||
this.tabp_game.Padding = new System.Windows.Forms.Padding(3);
|
this.tabp_game.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabp_game.Size = new System.Drawing.Size(1082, 594);
|
this.tabp_game.Size = new System.Drawing.Size(1082, 618);
|
||||||
this.tabp_game.TabIndex = 2;
|
this.tabp_game.TabIndex = 2;
|
||||||
this.tabp_game.Text = "4. Choose Game to start";
|
this.tabp_game.Text = "4. Choose Game to start";
|
||||||
//
|
//
|
||||||
@ -1340,7 +1339,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.tabp_after.Location = new System.Drawing.Point(4, 32);
|
this.tabp_after.Location = new System.Drawing.Point(4, 32);
|
||||||
this.tabp_after.Name = "tabp_after";
|
this.tabp_after.Name = "tabp_after";
|
||||||
this.tabp_after.Padding = new System.Windows.Forms.Padding(3);
|
this.tabp_after.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabp_after.Size = new System.Drawing.Size(1082, 594);
|
this.tabp_after.Size = new System.Drawing.Size(1082, 618);
|
||||||
this.tabp_after.TabIndex = 3;
|
this.tabp_after.TabIndex = 3;
|
||||||
this.tabp_after.Text = "5. Choose what happens afterwards";
|
this.tabp_after.Text = "5. Choose what happens afterwards";
|
||||||
//
|
//
|
||||||
|
@ -66,6 +66,9 @@ namespace DisplayMagician.UIForms
|
|||||||
ilv_saved_profiles.AllowDrag = false;
|
ilv_saved_profiles.AllowDrag = false;
|
||||||
ilv_saved_profiles.AllowDrop = false;
|
ilv_saved_profiles.AllowDrop = false;
|
||||||
ilv_saved_profiles.SetRenderer(new ProfileILVRenderer());
|
ilv_saved_profiles.SetRenderer(new ProfileILVRenderer());
|
||||||
|
|
||||||
|
lbl_profile_shown.Text = "No Display Profiles available";
|
||||||
|
lbl_profile_shown_subtitle.Text = "Please go back to the main window, click on 'Display Profiles', and save a new Display Profile. Then come back here.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortcutItem Shortcut
|
public ShortcutItem Shortcut
|
||||||
@ -818,34 +821,32 @@ namespace DisplayMagician.UIForms
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// We only get down here if the form has loaded a shortcut to edit
|
|
||||||
if (_shortcutToEdit is ShortcutItem && _shortcutToEdit.ProfileToUse is ProfileItem)
|
if (_shortcutToEdit != null)
|
||||||
{
|
{
|
||||||
foreach (ProfileItem loadedProfile in ProfileRepository.AllProfiles)
|
if (ProfileRepository.ContainsProfile(_shortcutToEdit.ProfileUUID))
|
||||||
{
|
{
|
||||||
if (_shortcutToEdit.ProfileToUse.Equals(loadedProfile))
|
// We have loaded the profile used last time
|
||||||
|
// so we need to show the selected profile in the UI
|
||||||
|
chosenProfile = ProfileRepository.GetProfile(_shortcutToEdit.ProfileUUID);
|
||||||
|
foundChosenProfileInLoadedProfiles = true;
|
||||||
|
|
||||||
|
// If the profile is the same, but the user has renamed the profile
|
||||||
|
// since the shortcut was last created, then we need to tell the user
|
||||||
|
if (!chosenProfile.IsPossible)
|
||||||
{
|
{
|
||||||
// We have loaded the profile used last time
|
|
||||||
// so we need to show the selected profile in the UI
|
|
||||||
chosenProfile = loadedProfile;
|
|
||||||
foundChosenProfileInLoadedProfiles = true;
|
|
||||||
|
|
||||||
// If the profile is the same, but the user has renamed the profile
|
MessageBox.Show(
|
||||||
// since the shortcut was last created, then we need to tell the user
|
$"The '{chosenProfile.Name}' Display Profile used by this Shortcut still exists, but it isn't possible to use it right now. You can either change the Display Profile this Shortcut uses, or you can change your Displays to make the Display Profile valid again.",
|
||||||
if (!loadedProfile.Name.Equals(_shortcutToEdit.ProfileToUse.Name))
|
@"Display Profile isn't possible now",
|
||||||
{
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Exclamation);
|
||||||
|
|
||||||
MessageBox.Show(
|
|
||||||
@"The Display Profile used by this Shortcut still exists, but it's changed it's name. We've updated the shortcut's name to reflect this change.",
|
|
||||||
@"Display Profile name changed",
|
|
||||||
MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Exclamation);
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundChosenProfileInLoadedProfiles && !String.IsNullOrWhiteSpace(_shortcutToEdit.ProfileUUID))
|
if (!foundChosenProfileInLoadedProfiles && !String.IsNullOrWhiteSpace(_shortcutToEdit.ProfileUUID))
|
||||||
@ -855,39 +856,13 @@ namespace DisplayMagician.UIForms
|
|||||||
@"Display Profile no longer exists",
|
@"Display Profile no longer exists",
|
||||||
MessageBoxButtons.OK,
|
MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Exclamation);
|
MessageBoxIcon.Exclamation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get to the end of the loaded profiles and haven't
|
// If we get to the end of the loaded profiles and haven't
|
||||||
// found a matching profile, then we need to show the current profile
|
// found a matching profile, then we need to show the current profile
|
||||||
// that we're running now
|
// that we're running now
|
||||||
if (!foundChosenProfileInLoadedProfiles && ProfileRepository.ProfileCount > 0)
|
else if (!foundChosenProfileInLoadedProfiles && ProfileRepository.ProfileCount > 0)
|
||||||
{
|
{
|
||||||
foreach (ProfileItem loadedProfile in ProfileRepository.AllProfiles)
|
chosenProfile = ProfileRepository.GetActiveProfile(); ;
|
||||||
{
|
|
||||||
if (ProfileRepository.CurrentProfile.Equals(loadedProfile))
|
|
||||||
{
|
|
||||||
// We have loaded the profile used last time
|
|
||||||
// so we need to show the selected profile in the UI
|
|
||||||
chosenProfile = loadedProfile;
|
|
||||||
foundChosenProfileInLoadedProfiles = true;
|
|
||||||
|
|
||||||
// If the profile is the same, but the user has renamed the profile
|
|
||||||
// since the shortcut was last created, then we need to tell the user
|
|
||||||
if (!loadedProfile.Name.Equals(ProfileRepository.CurrentProfile.Name))
|
|
||||||
{
|
|
||||||
|
|
||||||
MessageBox.Show(
|
|
||||||
@"The Display Profile used by this Shortcut still exists, but it's changed it's name. We've updated the shortcut's name to reflect this change.",
|
|
||||||
@"Display Profile name changed",
|
|
||||||
MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Exclamation);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user