Skip to content

Commit

Permalink
Fix TabPage.Title, if "Save Code" action is canceled.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Oct 10, 2024
1 parent df859a0 commit c66733f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ILSpy/ViewModels/TabPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ public static Task ShowTextViewAsync(this TabPageModel tabPage, Func<DecompilerT
textView = new DecompilerTextView();
tabPage.Content = textView;
}
string oldTitle = tabPage.Title;
tabPage.Title = Properties.Resources.Decompiling;
return action(textView);
try
{
return action(textView);
}
finally
{
if (tabPage.Title == Properties.Resources.Decompiling)
{
tabPage.Title = oldTitle;
}
}
}

public static void ShowTextView(this TabPageModel tabPage, Action<DecompilerTextView> action)
Expand All @@ -97,8 +108,13 @@ public static void ShowTextView(this TabPageModel tabPage, Action<DecompilerText
textView = new DecompilerTextView();
tabPage.Content = textView;
}
string oldTitle = tabPage.Title;
tabPage.Title = Properties.Resources.Decompiling;
action(textView);
if (tabPage.Title == Properties.Resources.Decompiling)
{
tabPage.Title = oldTitle;
}
}

public static void Focus(this TabPageModel tabPage)
Expand Down

0 comments on commit c66733f

Please sign in to comment.