Skip to content

Commit ac1fbaf

Browse files
committed
More cleanups
1 parent f24efcb commit ac1fbaf

File tree

8 files changed

+6
-17
lines changed

8 files changed

+6
-17
lines changed

src/FlaUInspect/App.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Reflection;
22
using System.Windows;
3-
using FlaUI.Core;
43
using FlaUInspect.Core.Logger;
54
using FlaUInspect.ViewModels;
65
using FlaUInspect.Views;

src/FlaUInspect/Core/Extensions/AutomationPropertyExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ namespace FlaUInspect.Core.Extensions;
55
public static class AutomationPropertyExtensions {
66
public static string? ToDisplayText<T>(this IAutomationProperty<T?> automationProperty) {
77
try {
8-
#pragma warning disable CA1416
98
bool success = automationProperty.TryGetValue(out T? value);
10-
#pragma warning restore CA1416
119
return success ? value == null ? string.Empty : value.ToString() : "Not Supported";
1210
}
1311
catch (Exception ex) {

src/FlaUInspect/Core/FocusTrackingMode.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Diagnostics;
2-
using FlaUI.Core;
1+
using FlaUI.Core;
32
using FlaUI.Core.AutomationElements;
43
using FlaUI.Core.EventHandlers;
54
using Application = System.Windows.Application;

src/FlaUInspect/Core/HoverMode.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Diagnostics;
2-
using System.Diagnostics.CodeAnalysis;
3-
using System.Windows.Input;
1+
using System.Windows.Input;
42
using System.Windows.Threading;
53
using FlaUI.Core;
64
using FlaUI.Core.AutomationElements;
@@ -36,7 +34,6 @@ public void Stop() {
3634
_dispatcherTimer.Stop();
3735
}
3836

39-
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
4037
private void DispatcherTimerTick(object? sender, EventArgs e) {
4138
if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control)) {
4239
Point screenPos = Mouse.Position;
@@ -46,7 +43,7 @@ private void DispatcherTimerTick(object? sender, EventArgs e) {
4643

4744
// Skip items in the current process
4845
// Like Inspect itself or the overlay window
49-
if (hoveredElement?.Properties.ProcessId == Process.GetCurrentProcess().Id) {
46+
if (hoveredElement?.Properties.ProcessId == Environment.ProcessId) {
5047
return;
5148
}
5249

src/FlaUInspect/Core/ObservableObject.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
using System.ComponentModel;
2-
using System.Diagnostics.CodeAnalysis;
32
using System.Linq.Expressions;
43
using System.Runtime.CompilerServices;
54

65
namespace FlaUInspect.Core;
76

8-
[SuppressMessage("ReSharper", "ExplicitCallerInfoArgument")]
97
public abstract class ObservableObject : INotifyPropertyChanged {
108

11-
private readonly Dictionary<string, object?> _backingFieldValues = new ();
9+
private readonly Dictionary<string, object?> _backingFieldValues = [];
1210
public event PropertyChangedEventHandler? PropertyChanged;
1311

1412
/// <summary>

src/FlaUInspect/Core/PatternItemsFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
namespace FlaUInspect.Core;
2626

27-
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
2827
public class PatternItemsFactory(AutomationBase? automationBase) {
2928
public const string Identification = "Identification";
3029
public const string Details = "Details";

src/FlaUInspect/ViewModels/MainViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
namespace FlaUInspect.ViewModels;
2222

23-
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
2423
public class MainViewModel : ObservableObject {
2524

2625
private readonly object _itemsLock = new();
@@ -162,7 +161,7 @@ private void ReadPatternsForSelectedItem(AutomationElement? selectedItemAutomati
162161
}
163162

164163
try {
165-
HashSet<PatternId> supportedPatterns = selectedItemAutomationElement.GetSupportedPatterns().ToHashSet();
164+
HashSet<PatternId> supportedPatterns = [.. selectedItemAutomationElement.GetSupportedPatterns()];
166165
IDictionary<string, PatternItem[]> patternItemsForElement = _patternItemsFactory.CreatePatternItemsForElement(selectedItemAutomationElement, supportedPatterns);
167166

168167
foreach (ElementPatternItem elementPattern in ElementPatterns) {

src/FlaUInspect/Views/ErrorListWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public partial class ErrorListWindow {
66
public ErrorListWindow(InternalLogger logger) {
77
InitializeComponent();
88

9-
List<InternalLoggerMessage> internalLoggerMessages = logger.Messages.ToList();
9+
List<InternalLoggerMessage> internalLoggerMessages = [.. logger.Messages];
1010
ErrorItemsControl.ItemsSource = internalLoggerMessages;
1111
}
1212
}

0 commit comments

Comments
 (0)