Browse Source

Fix TabPage.Title, if "Save Code" action is canceled.

pull/3307/head
Siegfried Pammer 2 years ago
parent
commit
c66733f353
  1. 18
      ILSpy/ViewModels/TabPageModel.cs

18
ILSpy/ViewModels/TabPageModel.cs

@ -86,8 +86,19 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView(); textView = new DecompilerTextView();
tabPage.Content = textView; tabPage.Content = textView;
} }
string oldTitle = tabPage.Title;
tabPage.Title = Properties.Resources.Decompiling; 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) public static void ShowTextView(this TabPageModel tabPage, Action<DecompilerTextView> action)
@ -97,8 +108,13 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView(); textView = new DecompilerTextView();
tabPage.Content = textView; tabPage.Content = textView;
} }
string oldTitle = tabPage.Title;
tabPage.Title = Properties.Resources.Decompiling; tabPage.Title = Properties.Resources.Decompiling;
action(textView); action(textView);
if (tabPage.Title == Properties.Resources.Decompiling)
{
tabPage.Title = oldTitle;
}
} }
public static void Focus(this TabPageModel tabPage) public static void Focus(this TabPageModel tabPage)

Loading…
Cancel
Save