Skip to content

Commit

Permalink
Profile: Don't allow rename on the current used one
Browse files Browse the repository at this point in the history
  • Loading branch information
Sora-yx committed Mar 20, 2024
1 parent 2a380d7 commit 5d6929d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions SA-Mod-Manager/Profile/ProfileDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ private void ProfileList_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (ProfileListView.SelectedItems.Count > 0 && ProfileListView.SelectedItems.Count < 2)
{
ProfileRename_Click(null, null);
e.Handled = true;
if (!ProfileListView.SelectedItems.Contains(currentProfile))
{
ProfileRename_Click(null, null);
e.Handled = true;
}
}
}

Expand All @@ -122,16 +125,17 @@ private void ContextMenu_Opened(object sender, RoutedEventArgs e)
{
var currentProfile = ProfileListView.Items[SelectedIndex];

// Delete Available Checks
// Delete and Rename Available Checks
if (ProfileListView.SelectedItems.Contains(currentProfile))
{
ProfileDelete.IsEnabled = false;
else
ProfileDelete.IsEnabled = true;

if (ProfileListView.SelectedItems.Count > 1)
ProfileRename.IsEnabled = false;
}
else
{
ProfileDelete.IsEnabled = true;
ProfileRename.IsEnabled = true;
}
}

private void ProfileRename_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 5d6929d

Please sign in to comment.