Fixed profile selection in new shortcuts

The shortcut selection logic was wrong. Now fixed.
This commit is contained in:
Terry MacDonald 2021-11-19 09:27:56 +13:00
parent ea38f25e28
commit 714cb910ec
4 changed files with 33 additions and 14 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")] [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information // Version information
[assembly: AssemblyVersion("2.1.0.239")] [assembly: AssemblyVersion("2.1.0.246")]
[assembly: AssemblyFileVersion("2.1.0.239")] [assembly: AssemblyFileVersion("2.1.0.246")]
[assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)] [assembly: CLSCompliant(true)]

View File

@ -225,7 +225,6 @@ namespace DisplayMagician.UIForms
this.tabc_shortcut.ShowToolTips = true; this.tabc_shortcut.ShowToolTips = true;
this.tabc_shortcut.Size = new System.Drawing.Size(1090, 767); this.tabc_shortcut.Size = new System.Drawing.Size(1090, 767);
this.tabc_shortcut.TabIndex = 28; this.tabc_shortcut.TabIndex = 28;
this.tabc_shortcut.Click += new System.EventHandler(this.tabc_shortcut_VisibleChanged);
// //
// tabp_display // tabp_display
// //

View File

@ -897,7 +897,7 @@ namespace DisplayMagician.UIForms
else if (rb_switch_display_temp.Checked) else if (rb_switch_display_temp.Checked)
txt_shortcut_save_name.Text = $"{_profileToUse.Name} (Temporary)"; txt_shortcut_save_name.Text = $"{_profileToUse.Name} (Temporary)";
} }
else if (rb_launcher.Checked && ilv_games.SelectedItems.Count >0) else if (rb_launcher.Checked && ilv_games.SelectedItems.Count > 0)
{ {
txt_shortcut_save_name.Text = $"{txt_game_name.Text} ({_profileToUse.Name})"; txt_shortcut_save_name.Text = $"{txt_game_name.Text} ({_profileToUse.Name})";
} }
@ -924,7 +924,7 @@ namespace DisplayMagician.UIForms
} }
} }
private void SelectGameInImageListView() /*private void SelectGameInImageListView()
{ {
ilv_games.ClearSelection(); ilv_games.ClearSelection();
IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_games.Items where item.Text == _shortcutToEdit.GameName select item); IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_games.Items where item.Text == _shortcutToEdit.GameName select item);
@ -937,7 +937,7 @@ namespace DisplayMagician.UIForms
ilv_games.EnsureVisible(itemToSelect.Index); ilv_games.EnsureVisible(itemToSelect.Index);
//ilv_games.Refresh(); //ilv_games.Refresh();
} }
} }*/
private void ClearForm() private void ClearForm()
{ {
@ -1309,10 +1309,30 @@ namespace DisplayMagician.UIForms
} }
// 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 (only if that's been saved)
else if (!foundChosenProfileInLoadedProfiles && ProfileRepository.ProfileCount > 0) else if (!foundChosenProfileInLoadedProfiles && ProfileRepository.ProfileCount > 0)
{ {
chosenProfile = ProfileRepository.GetActiveProfile(); ; ProfileItem currentProfile = ProfileRepository.GetActiveProfile();
bool foundCurrentProfile = false;
foreach(ProfileItem profileToCheck in ProfileRepository.AllProfiles)
{
if (profileToCheck.Equals(currentProfile))
{
chosenProfile = currentProfile;
foundCurrentProfile = true;
}
}
// If we get here, and we still haven't matched the profile, then just pick the first one
if (!foundCurrentProfile)
{
if (ProfileRepository.ProfileCount > 0)
{
chosenProfile = ProfileRepository.AllProfiles[0];
}
}
} }
@ -1450,7 +1470,7 @@ namespace DisplayMagician.UIForms
if (_editingExistingShortcut) if (_editingExistingShortcut)
{ {
ShortcutBitmap defaultBitmap = new ShortcutBitmap(); //ShortcutBitmap defaultBitmap = new ShortcutBitmap();
// Check if AvailableImages have been set, because if not, then we need to 'upgrade' the image structure // Check if AvailableImages have been set, because if not, then we need to 'upgrade' the image structure
// To use this new way of working // To use this new way of working
@ -2798,11 +2818,11 @@ namespace DisplayMagician.UIForms
EnableSaveButtonIfValid(); EnableSaveButtonIfValid();
} }
private void tabc_shortcut_VisibleChanged(object sender, EventArgs e) /*private void tabc_shortcut_VisibleChanged(object sender, EventArgs e)
{ {
if (tabc_shortcut.Visible == true) //if (tabc_shortcut.Visible == true)
SelectGameInImageListView(); // SelectGameInImageListView();
} }*/
private void btn_find_examples_startprograms_Click(object sender, EventArgs e) private void btn_find_examples_startprograms_Click(object sender, EventArgs e)
{ {