Skip to content

Commit 4ee8e1a

Browse files
committed
chore: cleanup unused namespaces - enable implicit usings
1 parent 52c04e2 commit 4ee8e1a

File tree

87 files changed

+310
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+310
-515
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ csharp_indent_labels = one_less_than_current
153153
csharp_using_directive_placement = outside_namespace:silent
154154
csharp_prefer_simple_using_statement = true:suggestion
155155
csharp_prefer_braces = true:silent
156-
csharp_style_namespace_declarations = file_scoped:warning
156+
csharp_style_namespace_declarations = file_scoped:silent
157157
csharp_style_prefer_method_group_conversion = true:silent
158158
csharp_style_prefer_top_level_statements = true:silent
159159
csharp_style_prefer_primary_constructors = true:suggestion

Directory.Build.props

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute;
2424
System.Runtime.CompilerServices.IsExternalInit;
2525
</PolySharpIncludeGeneratedTypes>
26+
<WarningsAsErrors>$(WarningsAsErrors);IDE0003</WarningsAsErrors>
27+
<ImplicitUsings>enable</ImplicitUsings>
2628
</PropertyGroup>
2729

2830
<PropertyGroup>

src/Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<IsPackable Condition=" '$(IsFormsProject)' ">!$(DisableFormsPublish)</IsPackable>
99
<IsPackable Condition=" '$(IsUnoProject)' ">!$(DisableUnoPublish)</IsPackable>
1010
<ContinuousIntegrationBuild Condition="'$(BUILD_BUILDID)' != ''">true</ContinuousIntegrationBuild>
11+
<ImplicitUsings>enable</ImplicitUsings>
1112
</PropertyGroup>
1213

1314
<Choose>

src/Maui/Prism.Maui.Rx/GlobalNavigationObserver.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Reactive.Subjects;
32
using Prism.Events;
43

src/Maui/Prism.Maui.Rx/IGlobalNavigationObserver.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System;
2-
31
namespace Prism.Navigation;
42

3+
54
public interface IGlobalNavigationObserver
65
{
76
IObservable<NavigationRequestContext> NavigationRequest { get; }

src/Maui/Prism.Maui.Rx/NavigationObserverRegistrationExtensions.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Prism.Ioc;
2-
31
namespace Prism.Navigation;
42

53
public static class NavigationObserverRegistrationExtensions
@@ -29,4 +27,4 @@ public static PrismAppBuilder AddGlobalNavigationObserver(this PrismAppBuilder b
2927
{
3028
addObservable(c, c.Resolve<IGlobalNavigationObserver>().NavigationRequest);
3129
});
32-
}
30+
}

src/Maui/Prism.Maui/PrismAppBuilderExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Extensions.Logging;
1+
using Microsoft.Extensions.Logging;
22
using Prism.Modularity;
33
using Prism.Mvvm;
44
using Prism.Navigation;

src/Uno/Prism.Uno/Interactivity/InvokeCommandAction.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Reflection;
4-
using System.Text;
52
using System.Windows.Input;
63
using Microsoft.Xaml.Interactivity;
7-
using Microsoft.UI.Xaml;
84

95

106
namespace Prism.Interactivity

src/Uno/Prism.Uno/Mvvm/ViewModelLocator.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Microsoft.UI.Xaml;
2-
31
namespace Prism.Mvvm
42
{
53
/// <summary>

src/Uno/Prism.Uno/Navigation/Regions/NavigationViewRegionAdapter.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using Microsoft.UI.Xaml;
2-
using Microsoft.UI.Xaml.Controls;
3-
41
namespace Prism.Navigation.Regions;
52

63
public sealed class NavigationViewRegionAdapter : RegionAdapterBase<NavigationView>

src/Uno/Prism.Uno/PrismApplicationBase.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using Microsoft.Extensions.DependencyInjection;
1+
using Microsoft.Extensions.DependencyInjection;
22
using Microsoft.Extensions.Hosting;
3-
using Microsoft.UI.Xaml;
43
using Prism.Common;
54
using Prism.Modularity;
65
using Prism.Mvvm;

src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
21
using DryIoc;
3-
using Prism.Container.DryIoc;
4-
using Prism.Ioc;
52
using ExceptionExtensions = System.ExceptionExtensions;
63

74
namespace Prism.DryIoc

src/Wpf/Prism.DryIoc.Wpf/PrismBootstrapper.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
21
using DryIoc;
3-
using Prism.Container.DryIoc;
4-
using Prism.Ioc;
52

63
namespace Prism.DryIoc
74
{

src/Wpf/Prism.Unity.Wpf/PrismApplication.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using Prism.Container.Unity;
3-
using Prism.Ioc;
41
using Unity;
52

63
namespace Prism.Unity

src/Wpf/Prism.Unity.Wpf/PrismBootstrapper.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using Prism.Container.Unity;
3-
using Prism.Ioc;
41
using Unity;
52

63
namespace Prism.Unity

src/Wpf/Prism.Wpf/Common/MvvmHelpers.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.ComponentModel;
4-
using System.Linq;
52
using Prism.Mvvm;
63

74
namespace Prism.Common

src/Wpf/Prism.Wpf/Dialogs/DialogService.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
21
using System.ComponentModel;
3-
using System.Linq;
4-
using System.Windows;
52
using Prism.Common;
6-
using Prism.Ioc;
73

84
namespace Prism.Dialogs
95
{

src/Wpf/Prism.Wpf/Dialogs/DialogWindow.xaml.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Windows;
2-
31
namespace Prism.Dialogs
42
{
53
/// <summary>

src/Wpf/Prism.Wpf/Dialogs/IDialogServiceCompatExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace Prism.Dialogs
42
{
53
/// <summary>

src/Wpf/Prism.Wpf/Dialogs/IDialogWindow.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
21
using System.ComponentModel;
3-
using System.Windows;
42

53
namespace Prism.Dialogs
64
{

src/Wpf/Prism.Wpf/Extensions/CollectionExtensions.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
2-
3-
using System.Collections.Generic;
4-
51
namespace System.Collections.ObjectModel
62
{
73
/// <summary>

src/Wpf/Prism.Wpf/Extensions/DependencyObjectExtensions.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
51
namespace Prism
62
{
73
internal static partial class DependencyObjectExtensions

src/Wpf/Prism.Wpf/Interactivity/CommandBehaviorBase.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Windows.Input;
32

43
namespace Prism.Interactivity

src/Wpf/Prism.Wpf/Interactivity/InvokeCommandAction.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Windows;
32
using System.Windows.Input;
43
using Microsoft.Xaml.Behaviors;
54

src/Wpf/Prism.Wpf/Ioc/ContainerProviderExtension.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Windows.Markup;
32

43
namespace Prism.Ioc

src/Wpf/Prism.Wpf/Ioc/IContainerRegistryExtensions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Diagnostics.CodeAnalysis;
32
using Prism.Mvvm;
43

src/Wpf/Prism.Wpf/Modularity/AssemblyResolver.Desktop.cs

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
2-
3-
using System;
4-
using System.Collections.Generic;
51
using System.IO;
6-
using System.Linq;
72
using System.Reflection;
83
using Prism.Properties;
94

@@ -17,7 +12,7 @@ public class AssemblyResolver : IAssemblyResolver, IDisposable
1712
{
1813
private readonly List<AssemblyInfo> registeredAssemblies = new List<AssemblyInfo>();
1914

20-
private bool handlesAssemblyResolve;
15+
private bool _handlesAssemblyResolve;
2116

2217
/// <summary>
2318
/// Registers the specified assembly and resolves the types in it when the AppDomain requests for it.
@@ -27,10 +22,10 @@ public class AssemblyResolver : IAssemblyResolver, IDisposable
2722
/// declared in the assembly.</remarks>
2823
public void LoadAssemblyFrom(string assemblyFilePath)
2924
{
30-
if (!this.handlesAssemblyResolve)
25+
if (!_handlesAssemblyResolve)
3126
{
32-
AppDomain.CurrentDomain.AssemblyResolve += this.CurrentDomain_AssemblyResolve;
33-
this.handlesAssemblyResolve = true;
27+
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
28+
_handlesAssemblyResolve = true;
3429
}
3530

3631
Uri assemblyUri = GetFileUri(assemblyFilePath);
@@ -46,15 +41,15 @@ public void LoadAssemblyFrom(string assemblyFilePath)
4641
}
4742

4843
AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyUri.LocalPath);
49-
AssemblyInfo assemblyInfo = this.registeredAssemblies.FirstOrDefault(a => assemblyName == a.AssemblyName);
44+
AssemblyInfo assemblyInfo = registeredAssemblies.FirstOrDefault(a => assemblyName == a.AssemblyName);
5045

5146
if (assemblyInfo != null)
5247
{
5348
return;
5449
}
5550

5651
assemblyInfo = new AssemblyInfo() { AssemblyName = assemblyName, AssemblyUri = assemblyUri };
57-
this.registeredAssemblies.Add(assemblyInfo);
52+
registeredAssemblies.Add(assemblyInfo);
5853
}
5954

6055
private static Uri GetFileUri(string filePath)
@@ -83,7 +78,7 @@ private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs a
8378
{
8479
AssemblyName assemblyName = new AssemblyName(args.Name);
8580

86-
AssemblyInfo assemblyInfo = this.registeredAssemblies.FirstOrDefault(a => AssemblyName.ReferenceMatchesDefinition(assemblyName, a.AssemblyName));
81+
AssemblyInfo assemblyInfo = registeredAssemblies.FirstOrDefault(a => AssemblyName.ReferenceMatchesDefinition(assemblyName, a.AssemblyName));
8782

8883
if (assemblyInfo != null)
8984
{
@@ -116,7 +111,7 @@ private class AssemblyInfo
116111
/// <filterpriority>2</filterpriority>
117112
public void Dispose()
118113
{
119-
this.Dispose(true);
114+
Dispose(true);
120115
GC.SuppressFinalize(this);
121116
}
122117

@@ -126,10 +121,10 @@ public void Dispose()
126121
/// <param name="disposing">When <see langword="true"/>, it is being called from the Dispose method.</param>
127122
protected virtual void Dispose(bool disposing)
128123
{
129-
if (this.handlesAssemblyResolve)
124+
if (_handlesAssemblyResolve)
130125
{
131-
AppDomain.CurrentDomain.AssemblyResolve -= this.CurrentDomain_AssemblyResolve;
132-
this.handlesAssemblyResolve = false;
126+
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
127+
_handlesAssemblyResolve = false;
133128
}
134129
}
135130

src/Wpf/Prism.Wpf/Modularity/ConfigurationModuleCatalog.Desktop.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Collections.ObjectModel;
4-
using System.Linq;
52
using Prism.Properties;
63

74
namespace Prism.Modularity

src/Wpf/Prism.Wpf/Modularity/ConfigurationStore.Desktop.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
using System.Configuration;
42

53
namespace Prism.Modularity

src/Wpf/Prism.Wpf/Modularity/DirectoryModuleCatalog.net45.cs

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Collections.ObjectModel;
42
using System.Globalization;
53
using System.IO;
6-
using System.Linq;
74
using System.Reflection;
85
using System.Security.Policy;
96
using Prism.Properties;
@@ -33,14 +30,14 @@ public class DirectoryModuleCatalog : ModuleCatalog
3330
/// </summary>
3431
protected override void InnerLoad()
3532
{
36-
if (string.IsNullOrEmpty(this.ModulePath))
33+
if (string.IsNullOrEmpty(ModulePath))
3734
throw new InvalidOperationException(Resources.ModulePathCannotBeNullOrEmpty);
3835

39-
if (!Directory.Exists(this.ModulePath))
36+
if (!Directory.Exists(ModulePath))
4037
throw new InvalidOperationException(
41-
string.Format(CultureInfo.CurrentCulture, Resources.DirectoryNotFound, this.ModulePath));
38+
string.Format(CultureInfo.CurrentCulture, Resources.DirectoryNotFound, ModulePath));
4239

43-
AppDomain childDomain = this.BuildChildDomain(AppDomain.CurrentDomain);
40+
AppDomain childDomain = BuildChildDomain(AppDomain.CurrentDomain);
4441

4542
try
4643
{
@@ -66,7 +63,7 @@ select assembly.Location
6663
(InnerModuleInfoLoader)
6764
childDomain.CreateInstanceFrom(loaderType.Assembly.Location, loaderType.FullName).Unwrap();
6865
loader.LoadAssemblies(loadedAssemblies);
69-
this.Items.AddRange(loader.GetModuleInfos(this.ModulePath));
66+
Items.AddRange(loader.GetModuleInfos(ModulePath));
7067
}
7168
}
7269
finally

src/Wpf/Prism.Wpf/Modularity/DirectoryModuleCatalog.netcore.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Collections.ObjectModel;
44
using System.Globalization;
@@ -32,12 +32,12 @@ public class DirectoryModuleCatalog : ModuleCatalog
3232
/// </summary>
3333
protected override void InnerLoad()
3434
{
35-
if (string.IsNullOrEmpty(this.ModulePath))
35+
if (string.IsNullOrEmpty(ModulePath))
3636
throw new InvalidOperationException(Resources.ModulePathCannotBeNullOrEmpty);
3737

38-
if (!Directory.Exists(this.ModulePath))
38+
if (!Directory.Exists(ModulePath))
3939
throw new InvalidOperationException(
40-
string.Format(CultureInfo.CurrentCulture, Resources.DirectoryNotFound, this.ModulePath));
40+
string.Format(CultureInfo.CurrentCulture, Resources.DirectoryNotFound, ModulePath));
4141

4242
AppDomain childDomain = AppDomain.CurrentDomain;
4343

@@ -63,7 +63,7 @@ select assembly.Location
6363
(InnerModuleInfoLoader)
6464
childDomain.CreateInstanceFrom(loaderType.Assembly.Location, loaderType.FullName).Unwrap();
6565

66-
this.Items.AddRange(loader.GetModuleInfos(this.ModulePath));
66+
Items.AddRange(loader.GetModuleInfos(ModulePath));
6767
}
6868
}
6969
catch (Exception ex)

0 commit comments

Comments
 (0)