Browse Source

Do not use ObservableObject when ObservableObjectBase is sufficient.

pull/3644/head
tom-englert 1 week ago
parent
commit
f9048cd369
  1. 2
      ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs
  2. 2
      ILSpy.ReadyToRun/ReadyToRunOptions.cs
  3. 14
      ILSpy/AssemblyTree/AssemblyTreeModel.cs
  4. 2
      ILSpy/Docking/DockWorkspace.cs
  5. 2
      ILSpy/LanguageSettings.cs
  6. 2
      ILSpy/MainWindowViewModel.cs
  7. 2
      ILSpy/Options/DisplaySettings.cs
  8. 2
      ILSpy/Options/DisplaySettingsViewModel.cs
  9. 2
      ILSpy/Options/MiscSettings.cs
  10. 2
      ILSpy/Options/MiscSettingsViewModel.cs
  11. 4
      ILSpy/Options/OptionsDialogViewModel.cs
  12. 2
      ILSpy/ViewModels/CompareViewModel.cs
  13. 2
      ILSpy/ViewModels/ManageAssemblyListsViewModel.cs
  14. 2
      ILSpy/ViewModels/PaneModel.cs
  15. 2
      ILSpy/ViewModels/UpdatePanelViewModel.cs
  16. 4
      TestPlugin/CustomOptionPage.xaml.cs

2
ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs

@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
[ExportOptionPage(Order = 40)]
[NonShared]
class ReadyToRunOptionsViewModel : ObservableObject, IOptionPage
class ReadyToRunOptionsViewModel : ObservableObjectBase, IOptionPage
{
private ReadyToRunOptions options;

2
ILSpy.ReadyToRun/ReadyToRunOptions.cs

@ -24,7 +24,7 @@ using TomsToolbox.Wpf; @@ -24,7 +24,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.ReadyToRun
{
internal partial class ReadyToRunOptions : ObservableObject, ISettingsSection
internal partial class ReadyToRunOptions : ObservableObjectBase, ISettingsSection
{
private static readonly XNamespace ns = "http://www.ilspy.net/ready-to-run";

14
ILSpy/AssemblyTree/AssemblyTreeModel.cs

@ -72,6 +72,8 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -72,6 +72,8 @@ namespace ICSharpCode.ILSpy.AssemblyTree
private readonly LanguageService languageService;
private readonly IExportProvider exportProvider;
private static Dispatcher UIThread => Application.Current.Dispatcher;
public AssemblyTreeModel(SettingsService settingsService, LanguageService languageService, IExportProvider exportProvider)
{
this.settingsService = settingsService;
@ -198,7 +200,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -198,7 +200,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
{
var cmdArgs = CommandLineArguments.Create(args);
await Dispatcher.InvokeAsync(async () => {
await UIThread.InvokeAsync(async () => {
if (!HandleCommandLineArguments(cmdArgs))
return;
@ -256,7 +258,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -256,7 +258,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
// Make sure we wait for assemblies being loaded...
// BeginInvoke in LoadedAssembly.LookupReferencedAssemblyInternal
await Dispatcher.InvokeAsync(delegate { }, DispatcherPriority.Normal);
await UIThread.InvokeAsync(delegate { }, DispatcherPriority.Normal);
if (mr is { ParentModule.MetadataFile: not null })
{
@ -401,7 +403,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -401,7 +403,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
AssemblyList.Open(sessionSettings.ActiveAutoLoadedAssembly, true);
}
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, OpenAssemblies);
UIThread.BeginInvoke(DispatcherPriority.Loaded, OpenAssemblies);
}
private async Task OpenAssemblies()
@ -536,14 +538,14 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -536,14 +538,14 @@ namespace ICSharpCode.ILSpy.AssemblyTree
if (SelectedItem == node)
{
Dispatcher.BeginInvoke(RefreshDecompiledView);
UIThread.BeginInvoke(RefreshDecompiledView);
}
else
{
activeView?.ScrollIntoView(node);
SelectedItem = node;
Dispatcher.BeginInvoke(DispatcherPriority.Background, () => {
UIThread.BeginInvoke(DispatcherPriority.Background, () => {
activeView?.ScrollIntoView(node);
});
}
@ -795,7 +797,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -795,7 +797,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
{
ContextMenuProvider.ContextMenuClosed -= ContextMenuClosed;
Dispatcher.BeginInvoke(DispatcherPriority.Background, () => {
UIThread.BeginInvoke(DispatcherPriority.Background, () => {
if (Mouse.RightButton != MouseButtonState.Pressed)
{
RefreshDecompiledView();

2
ILSpy/Docking/DockWorkspace.cs

@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpy.Docking @@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpy.Docking
{
[Export]
[Shared]
public class DockWorkspace : ObservableObject, ILayoutUpdateStrategy
public class DockWorkspace : ObservableObjectBase, ILayoutUpdateStrategy
{
private readonly IExportProvider exportProvider;

2
ILSpy/LanguageSettings.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpy @@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpy
/// <summary>
/// Represents the filters applied to the tree view.
/// </summary>
public class LanguageSettings : ObservableObject, IChildSettings
public class LanguageSettings : ObservableObjectBase, IChildSettings
{
/// <summary>
/// This dictionary is necessary to remember language versions across language changes. For example,

2
ILSpy/MainWindowViewModel.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy @@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy
{
[Export]
[Shared]
public class MainWindowViewModel(SettingsService settingsService, LanguageService languageService, DockWorkspace dockWorkspace) : ObservableObject
public class MainWindowViewModel(SettingsService settingsService, LanguageService languageService, DockWorkspace dockWorkspace) : ObservableObjectBase
{
public DockWorkspace Workspace { get; } = dockWorkspace;

2
ILSpy/Options/DisplaySettings.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.Options @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.Options
/// <summary>
/// Description of DisplaySettings.
/// </summary>
public class DisplaySettings : ObservableObject, ISettingsSection
public class DisplaySettings : ObservableObjectBase, ISettingsSection
{
FontFamily selectedFont;
public FontFamily SelectedFont {

2
ILSpy/Options/DisplaySettingsViewModel.cs

@ -14,7 +14,7 @@ namespace ICSharpCode.ILSpy.Options @@ -14,7 +14,7 @@ namespace ICSharpCode.ILSpy.Options
{
[ExportOptionPage(Order = 20)]
[NonShared]
public class DisplaySettingsViewModel : ObservableObject, IOptionPage
public class DisplaySettingsViewModel : ObservableObjectBase, IOptionPage
{
private DisplaySettings settings = new();
private FontFamily[] fontFamilies;

2
ILSpy/Options/MiscSettings.cs

@ -23,7 +23,7 @@ using TomsToolbox.Wpf; @@ -23,7 +23,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpyX.Settings
{
public class MiscSettings : ObservableObject, ISettingsSection
public class MiscSettings : ObservableObjectBase, ISettingsSection
{
private bool allowMultipleInstances;
private bool loadPreviousAssemblies = true;

2
ILSpy/Options/MiscSettingsViewModel.cs

@ -34,7 +34,7 @@ namespace ICSharpCode.ILSpy.Options @@ -34,7 +34,7 @@ namespace ICSharpCode.ILSpy.Options
{
[ExportOptionPage(Order = 30)]
[NonShared]
public class MiscSettingsViewModel : ObservableObject, IOptionPage
public class MiscSettingsViewModel : ObservableObjectBase, IOptionPage
{
private MiscSettings settings;
public MiscSettings Settings {

4
ILSpy/Options/OptionsDialogViewModel.cs

@ -27,14 +27,14 @@ using TomsToolbox.Wpf; @@ -27,14 +27,14 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.Options
{
public class OptionsItemViewModel(IOptionPage content) : ObservableObject
public class OptionsItemViewModel(IOptionPage content) : ObservableObjectBase
{
public string Title { get; } = content.Title;
public IOptionPage Content { get; } = content;
}
public class OptionsDialogViewModel : ObservableObject
public class OptionsDialogViewModel : ObservableObjectBase
{
private IOptionPage? selectedPage;

2
ILSpy/ViewModels/CompareViewModel.cs

@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpy.ViewModels
using TomsToolbox.Wpf;
class CompareViewModel : ObservableObject
class CompareViewModel : ObservableObjectBase
{
private readonly TabPageModel tabPage;
private readonly AssemblyTreeModel assemblyTreeModel;

2
ILSpy/ViewModels/ManageAssemblyListsViewModel.cs

@ -34,7 +34,7 @@ using DelegateCommand = ICSharpCode.ILSpy.Commands.DelegateCommand; @@ -34,7 +34,7 @@ using DelegateCommand = ICSharpCode.ILSpy.Commands.DelegateCommand;
namespace ICSharpCode.ILSpy.ViewModels
{
public class ManageAssemblyListsViewModel : ObservableObject
public class ManageAssemblyListsViewModel : ObservableObjectBase
{
private readonly AssemblyListManager manager;
private readonly Window parent;

2
ILSpy/ViewModels/PaneModel.cs

@ -27,7 +27,7 @@ using TomsToolbox.Wpf; @@ -27,7 +27,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.ViewModels
{
public abstract class PaneModel : ObservableObject
public abstract class PaneModel : ObservableObjectBase
{
private readonly Throttle titleChangeThrottle;

2
ILSpy/ViewModels/UpdatePanelViewModel.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.ViewModels; @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.ViewModels;
[Export]
[NonShared]
public class UpdatePanelViewModel : ObservableObject
public class UpdatePanelViewModel : ObservableObjectBase
{
bool isPanelVisible;
string updateAvailableDownloadUrl;

4
TestPlugin/CustomOptionPage.xaml.cs

@ -25,7 +25,7 @@ namespace TestPlugin @@ -25,7 +25,7 @@ namespace TestPlugin
[ExportOptionPage(Order = 0)]
[NonShared]
class CustomOptionsViewModel : ObservableObject, IOptionPage
class CustomOptionsViewModel : ObservableObjectBase, IOptionPage
{
private Options options;
@ -47,7 +47,7 @@ namespace TestPlugin @@ -47,7 +47,7 @@ namespace TestPlugin
}
}
class Options : ObservableObject, ISettingsSection
class Options : ObservableObjectBase, ISettingsSection
{
static readonly XNamespace ns = "http://www.ilspy.net/testplugin";

Loading…
Cancel
Save