Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[housekeeping] Automated PR to fix formatting errors #153

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sample/PrismSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override async void OnInitialized()

var result = await NavigationService.NavigateAsync("MainPage");

if(!result.Success)
if (!result.Success)
{
MainPage = new MainPage
{
Expand Down
2 changes: 1 addition & 1 deletion sample/PrismSample/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public string Message

private void OnConnectivityChanged(bool connected)
{
if(connected)
if (connected)
{
Message = "The internet is connected... We can now do our anti-Social Media... and swipe right, and like our friend's lunch...";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class IServiceCollectionExtensions
/// <returns></returns>
public static IContainerRegistry RegisterServices(this IContainerRegistry containerRegistry, Action<IServiceCollection> registerServices)
{
if(containerRegistry is IServiceCollectionAware sca)
if (containerRegistry is IServiceCollectionAware sca)
{
sca.RegisterServices(registerServices);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ protected override void OnAttachedTo(TabbedPage bindable)
{
base.OnAttachedTo(bindable);
bindable.SetBinding(Page.TitleProperty, new Binding { Path = "CurrentPage.Title", Source = bindable });
if(bindable.BindingContext is INotifyPropertyChanged vm)

if (bindable.BindingContext is INotifyPropertyChanged vm)
{
vm.PropertyChanged += OnViewModelPropertyChanged;
}
Expand All @@ -28,7 +28,7 @@ protected override void OnDetachingFrom(TabbedPage bindable)

private void OnViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if(e.PropertyName == "Title")
if (e.PropertyName == "Title")
{
AssociatedObject.RemoveBinding(Page.TitleProperty);
var property = AssociatedObject.BindingContext.GetType().GetProperty(e.PropertyName);
Expand Down
6 changes: 3 additions & 3 deletions src/Prism.Forms.Extended/Commands/ExecutionAwareCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override void Execute(object parameter)
{
IsExecuting = true;

if(AsyncExecuteDelegate is null)
if (AsyncExecuteDelegate is null)
{
ExecuteDelegate();
}
Expand All @@ -53,14 +53,14 @@ protected override void Execute(object parameter)
}
catch (Exception ex)
{
if(!_registry.HandledException(ex))
if (!_registry.HandledException(ex))
{
throw new UnhandledCommandException(ex);
}
}
finally
{
if(AsyncExecuteDelegate is null)
if (AsyncExecuteDelegate is null)
{
IsExecuting = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Prism.Forms.Extended/Commands/ExecutionAwareCommand{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ protected override bool CanExecute(object parameter)
try
{
T param = default;
if(parameter is T TParam)
if (parameter is T TParam)
{
param = TParam;
}
else if(parameter != null && ThrowOnInvalidCast)
else if (parameter != null && ThrowOnInvalidCast)
{
throw new InvalidCastException($"The Command expected a typeof '{typeof(T).FullName}' but recieved a parameter of type '{parameter.GetType().FullName}");
}
Expand Down
6 changes: 3 additions & 3 deletions src/Prism.Forms.Extended/Common/ErrorHandlerRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ public bool HandledException(Exception ex)
if (ex is null) return true;

var type = ex.GetType();
foreach(var key in Keys)
foreach (var key in Keys)
{
if(type.IsAssignableFrom(key))
if (type.IsAssignableFrom(key))
{
var handler = this[key];
handler?.Invoke(ex);
return true;
}
}

if(ex is AggregateException ae)
if (ex is AggregateException ae)
{
var results = ae.InnerExceptions.Select(e => HandledException(e));
return results.Where(x => x == false).Count() == 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Prism.Forms.Extended/Ioc/RequiredTypesExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void RegisterRequiredTypes(this IContainerRegistry containerRegist

public static void RegisterPrismCoreServices(this IServiceCollection services)
{
if(!services.IsRegistered<IAggregateLogger>())
if (!services.IsRegistered<IAggregateLogger>())
{
services.AddSingleton<AggregateLogger>(p =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected async override Task<INavigationResult> GoBackInternal(INavigationParam
{
var result = await base.GoBackInternal(parameters, useModalNavigation, animated);

if(result.Exception != null)
if (result.Exception != null)
{
EventAggregator.GetEvent<NavigationErrorEvent>().Publish(new NavigationError
{
Expand All @@ -40,7 +40,7 @@ protected async override Task<INavigationResult> GoBackInternal(INavigationParam

protected override async Task<INavigationResult> GoBackToRootInternal(INavigationParameters parameters)
{
var result = await base.GoBackToRootInternal(parameters);
var result = await base.GoBackToRootInternal(parameters);

if (result.Exception != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Prism.Forms.Extended/Navigation/NavigationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public NavigationBuilder WithParameters(INavigationParameters parameters)

public NavigationBuilder WithParameters(params (string key, object value)[] parameters)
{
if(_parameters is null)
if (_parameters is null)
{
_parameters = new NavigationParameters();
}

foreach((var key, var value) in parameters)
foreach ((var key, var value) in parameters)
{
_parameters.Add(key, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private object GetConcreteImplementation(Type serviceType)
return sp.GetService(serviceType);
}

if(serviceType.IsValueType)
if (serviceType.IsValueType)
{
return Activator.CreateInstance(serviceType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public ConcreteAwareServiceScope(IServiceScope serviceScope)
public IServiceProvider ServiceProvider { get; }

#region IDisposable Support


protected virtual void Dispose(bool disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class MicrsoftDependencyInjectionExtensions
{
public static IServiceCollection ServiceCollection(this IContainerRegistry containerRegistry)
{
if(containerRegistry is PrismContainerExtension pce)
if (containerRegistry is PrismContainerExtension pce)
{
return pce.Services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Type GetRegistrationType(string key)
private void CheckDuplicate(string name, Type serviceType)
{
var registry = GetServiceRegistry(name, serviceType);
if(registry != null)
if (registry != null)
{
Console.WriteLine($"'{serviceType.FullName}' with the name '{name}' has already been registered and will be replaced.");
Services.Remove(registry);
Expand All @@ -87,7 +87,7 @@ class NamedSingletonService : NamedService

public override object GetService(IServiceProvider serviceProvider)
{
if(Instance is null)
if (Instance is null)
{
Instance = serviceProvider.GetOrConstructService(ImplementationType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ private static IContainerExtension TryGetContainer()
public IServiceCollection Services { get; private set; }


private IServiceScope _parentScope=null;
private IServiceScope _parentScope = null;
private IServiceProvider _instance;
public IServiceProvider Instance
{
get
{
bool createScope = false;
if(requiresRebuild || _instance is null)
if (requiresRebuild || _instance is null)
{
if (_serviceScope != null)
{
Expand All @@ -88,7 +88,7 @@ public IServiceProvider Instance
_instance = new ConcreteAwareServiceProvider(Services.BuildServiceProvider());
requiresRebuild = false;

if(createScope)
if (createScope)
{
_parentScope = _instance.CreateScope();
_serviceScope = new ConcreteAwareServiceScope(_parentScope);
Expand Down Expand Up @@ -119,9 +119,9 @@ public PrismContainerExtension(IServiceCollection services)

public void SetServiceCollection(IServiceCollection services)
{
if(Services.Any())
if (Services.Any())
{
foreach(var service in Services)
foreach (var service in Services)
{
services.Add(service);
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public IContainerRegistry Register(Type from, Type to, string name)
Services.AddTransient(to);
NamedServiceRegistry.Add(name, from, to);

if(from == typeof(object) && to.Namespace.Contains("Views"))
if (from == typeof(object) && to.Namespace.Contains("Views"))
{

}
Expand All @@ -234,7 +234,7 @@ public IContainerRegistry RegisterServices(Action<IServiceCollection> registerSe
public IContainerRegistry RegisterMany(Type implementingType, params Type[] serviceTypes)
{
requiresRebuild = true;
if(serviceTypes is null || serviceTypes.Count() == 0)
if (serviceTypes is null || serviceTypes.Count() == 0)
{
serviceTypes = implementingType.GetInterfaces();
}
Expand Down Expand Up @@ -419,7 +419,7 @@ public IScopedProvider CreateScope()

public void Dispose()
{
if(_serviceScope != null)
if (_serviceScope != null)
{
_serviceScope.Dispose();
_serviceScope = null;
Expand Down
4 changes: 2 additions & 2 deletions src/Shiny.Prism/Modularity/IModuleCatalogExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public static bool HasStartupModules(this IModuleCatalog moduleCatalog, out IEnu
{
startupModules = FilterForStartup(moduleCatalog.Modules);

if(startupModules.Any())
if (startupModules.Any())
{
startupModules = moduleCatalog.CompleteListWithDependencies(startupModules);
}

return startupModules.Any();
}

private static IEnumerable<IModuleInfo> FilterForStartup(IEnumerable<IModuleInfo> modules) =>
private static IEnumerable<IModuleInfo> FilterForStartup(IEnumerable<IModuleInfo> modules) =>
modules.Where(m => Type.GetType(m.ModuleType)
.GetInterfaces()
.Any(x => x == typeof(IStartupModule))
Expand Down
2 changes: 1 addition & 1 deletion src/Shiny.Prism/Modularity/ShinyPrismModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal static class IShinyPrismModuleInitailzierExtensions
{
public static void LoadShinyModules(this IShinyPrismModuleInitializer initializer, IEnumerable<IModuleInfo> modules)
{
foreach(var module in modules)
foreach (var module in modules)
{
initializer.LoadShinyModule(module);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Shiny.Prism/Navigation/NavigationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class NavigationExtensions
public static void UseNavigationDelegate(this IServiceCollection services)
{
services.AddSingleton<INavigationServiceDelegate, NavigationServiceDelegate>();
if(!services.Any(x => x.ServiceType == typeof(IApplicationProvider)))
if (!services.Any(x => x.ServiceType == typeof(IApplicationProvider)))
{
services.AddSingleton<IApplicationProvider, ApplicationProvider>();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Shiny.Prism/Navigation/NavigationServiceDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Task<INavigationResult> INavigationService.NavigateAsync(string name)
Task<INavigationResult> INavigationService.NavigateAsync(string name, INavigationParameters parameters)
{
var navService = GetNavigationService();
if(navService is null)
if (navService is null)
{
return PrismNotInitialized();
}
Expand Down Expand Up @@ -132,7 +132,7 @@ private INavigationService GetNavigationService()
if (PrismApplicationBase.Current is null) return null;

IContainerProvider container = Container;
var navService = container.IsRegistered<INavigationService>(NavigationServiceName) ?
var navService = container.IsRegistered<INavigationService>(NavigationServiceName) ?
container.Resolve<INavigationService>(NavigationServiceName) :
container.Resolve<INavigationService>();

Expand Down
4 changes: 2 additions & 2 deletions src/Shiny.Prism/PrismStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void IShinyStartup.ConfigureServices(IServiceCollection services)
IServiceProvider IShinyStartup.CreateServiceProvider(IServiceCollection services)
{
var container = ContainerLocator.Current;
if(container is null && (container = CreateContainerExtension()) is null)
if (container is null && (container = CreateContainerExtension()) is null)
{
throw new NullReferenceException("Call PrismContainerExtension.Init() prior to initializing PrismApplication");
}
Expand All @@ -47,7 +47,7 @@ IServiceProvider IShinyStartup.CreateServiceProvider(IServiceCollection services
var moduleCatalog = container.Resolve<IModuleCatalog>();
ConfigureModuleCatalog(moduleCatalog);

if(moduleCatalog.Modules.Any() && moduleCatalog.HasStartupModules(out var startupModules))
if (moduleCatalog.Modules.Any() && moduleCatalog.HasStartupModules(out var startupModules))
{
var moduleInitializer = container.Resolve<IModuleInitializer>() as IShinyPrismModuleInitializer;
moduleInitializer.LoadShinyModules(startupModules);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Prism.Container.Extensions.Shared.Mocks
{
public class MockDbContext : DbContext
{
public MockDbContext([NotNull] DbContextOptions<MockDbContext> options)
public MockDbContext([NotNull] DbContextOptions<MockDbContext> options)
: base(options)
{
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Prism.Forms.Extended.Mocks/Mocks/AppMock.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class AppMock : PrismApplication
{
public AppMock()
{

}

public new INavigationService NavigationService => base.NavigationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public Task<INavigationResult> GoBackAsync(INavigationParameters parameters)

public Task<INavigationResult> GoBackAsync(INavigationParameters parameters, bool? useModalNavigation, bool animated)
{
if(parameters is null)
if (parameters is null)
{
parameters = new NavigationParameters();
}
if(useModalNavigation.HasValue)
if (useModalNavigation.HasValue)
{
parameters.Add(KnownNavigationParameters.UseModalNavigation, useModalNavigation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public async Task UsesExplicitValue()

Assert.True(iOSPage.GetUseSafeArea(app.MainPage));

result = await app.NavigationService.NavigateAsync("/ViewB");
result = await app.NavigationService.NavigateAsync("/ViewB");
Assert.True(result.Success);
Assert.IsType<ViewB>(app.MainPage);

Expand All @@ -144,7 +144,7 @@ public void ErrorReportingNavigationServiceIsRegistered()
// The unnamed resolve is Scoped while the Named is transient
ex = Record.Exception(() => navService = app.Container.Resolve<INavigationService>(PrismApplicationBase.NavigationServiceName));

if(ex is ContainerResolutionException cre)
if (ex is ContainerResolutionException cre)
{
var errors = cre.GetErrors();
}
Expand Down
Loading