diff --git a/src/Avalonia.Diagnostics/Diagnostics/Convetions.cs b/src/Avalonia.Diagnostics/Diagnostics/Conventions.cs similarity index 80% rename from src/Avalonia.Diagnostics/Diagnostics/Convetions.cs rename to src/Avalonia.Diagnostics/Diagnostics/Conventions.cs index b41755f239..9091b83ba2 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Convetions.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/Conventions.cs @@ -1,11 +1,8 @@ using System; -using System.Reflection; -using Avalonia.Controls; -using Avalonia.VisualTree; namespace Avalonia.Diagnostics { - static class Convetions + internal static class Conventions { public static string DefaultScreenshotsRoot => System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures, Environment.SpecialFolderOption.Create), diff --git a/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs b/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs index 5672641602..5fc274a4e9 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Input; +using Avalonia.Input; namespace Avalonia.Diagnostics { @@ -36,11 +35,11 @@ namespace Avalonia.Diagnostics public bool ShowImplementedInterfaces { get; set; } = true; /// - /// Allow to customizze SreenshotHandler + /// Allow to customize SreenshotHandler /// /// Default handler is public IScreenshotHandler ScreenshotHandler { get; set; } - = Convetions.DefaultScreenshotHandler; + = Conventions.DefaultScreenshotHandler; /// /// Gets or sets whether DevTools should use the dark mode theme diff --git a/src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs b/src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs index 4153d2d38c..a4b56fcea1 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using System.Linq; using System.Threading.Tasks; using Avalonia.Controls; @@ -40,7 +39,7 @@ namespace Avalonia.Diagnostics.Screenshots /// The default root folder is [Environment.SpecialFolder.MyPictures]/Screenshots. /// public string ScreenshotsRoot { get; } - = Convetions.DefaultScreenshotsRoot; + = Conventions.DefaultScreenshotsRoot; /// /// SaveFilePicker Title diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs index 7384daae30..0e412a2fa5 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs @@ -1,6 +1,5 @@ using System; using Avalonia.Data; -using Avalonia.Media; namespace Avalonia.Diagnostics.ViewModels { diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs index 73fb615b32..895ff41f7b 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Reflection; -using Avalonia.Media; namespace Avalonia.Diagnostics.ViewModels { diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs index 631da80d8b..71da543d70 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Collections.Specialized; using System.ComponentModel; using System.Linq; using System.Reflection; @@ -15,7 +14,7 @@ using Avalonia.VisualTree; namespace Avalonia.Diagnostics.ViewModels { - internal class ControlDetailsViewModel : ViewModelBase, IDisposable + internal class ControlDetailsViewModel : ViewModelBase, IDisposable, IClassesChangedListener { private readonly IAvaloniaObject _avaloniaObject; private IDictionary? _propertyIndex; @@ -46,7 +45,7 @@ namespace Avalonia.Diagnostics.ViewModels if (avaloniaObject is StyledElement styledElement) { - styledElement.Classes.CollectionChanged += OnClassesChanged; + styledElement.Classes.AddListener(this); var pseudoClassAttributes = styledElement.GetType().GetCustomAttributes(true); @@ -250,7 +249,7 @@ namespace Avalonia.Diagnostics.ViewModels if (_avaloniaObject is StyledElement se) { - se.Classes.CollectionChanged -= OnClassesChanged; + se.Classes.RemoveListener(this); } } @@ -325,7 +324,7 @@ namespace Avalonia.Diagnostics.ViewModels } } - private void OnClassesChanged(object? sender, NotifyCollectionChangedEventArgs e) + void IClassesChangedListener.Changed() { if (!SnapshotStyles) { diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs index 9e8a5d8d9b..a0514cdd76 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs @@ -1,13 +1,11 @@ using System; using System.ComponentModel; using System.Reactive.Linq; -using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Diagnostics.Models; using Avalonia.Input; using Avalonia.Metadata; using Avalonia.Threading; -using System.Linq; namespace Avalonia.Diagnostics.ViewModels { @@ -96,7 +94,9 @@ namespace Avalonia.Diagnostics.ViewModels changed = false; } if (changed) - RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value); + { + RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value); + } } } @@ -331,7 +331,7 @@ namespace Avalonia.Diagnostics.ViewModels private set => RaiseAndSetIfChanged(ref _showImplementedInterfaces , value); } - public void ToggleShowImplementedInterfaces(object parametr) + public void ToggleShowImplementedInterfaces(object parameter) { ShowImplementedInterfaces = !ShowImplementedInterfaces; if (Content is TreePageViewModel viewModel) @@ -340,15 +340,15 @@ namespace Avalonia.Diagnostics.ViewModels } } - public bool ShowDettailsPropertyType + public bool ShowDetailsPropertyType { get => _showPropertyType; private set => RaiseAndSetIfChanged(ref _showPropertyType , value); } - public void ToggleShowDettailsPropertyType(object paramter) + public void ToggleShowDetailsPropertyType(object parameter) { - ShowDettailsPropertyType = !ShowDettailsPropertyType; + ShowDetailsPropertyType = !ShowDetailsPropertyType; } } } diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs index 5459810db9..4fc55333d0 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs @@ -6,7 +6,6 @@ using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.LogicalTree; using Avalonia.Media; -using Avalonia.VisualTree; namespace Avalonia.Diagnostics.ViewModels { diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml index a426b387f7..bf595d82a3 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml @@ -19,7 +19,7 @@