This commit is contained in:
Nick Randolph 2018-03-14 10:59:03 +11:00
Родитель e01373b899
Коммит cdda48351c
2 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -72,9 +72,9 @@ csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Newline settings
csharp_new_line_before_open_brace = anonymous_types,accessors,object_collection_array_initalizers,methods,properties,types
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true

Просмотреть файл

@ -22,7 +22,7 @@ namespace MvvmCross.Core
public abstract class MvxSetup
{
protected static Type RegisteredSetupType { get; set; }
public static void RegisterSetupType<TMvxSetup>() where TMvxSetup: MvxSetup,new()
public static void RegisterSetupType<TMvxSetup>() where TMvxSetup : MvxSetup, new()
{
RegisteredSetupType = typeof(TMvxSetup);
}
@ -33,16 +33,19 @@ namespace MvvmCross.Core
get
{
if (instance != null) return instance;
if (RegisteredSetupType != null) {
if (RegisteredSetupType != null)
{
instance = Activator.CreateInstance(RegisteredSetupType) as MvxSetup;
} else {
}
else
{
instance = MvxSetupExtensions.CreateSetup<MvxSetup>();
}
return instance;
}
}
public static TMvxSetup PlatformInstance<TMvxSetup>() where TMvxSetup:MvxSetup
public static TMvxSetup PlatformInstance<TMvxSetup>() where TMvxSetup : MvxSetup
{
return Instance as TMvxSetup;
}
@ -63,7 +66,8 @@ namespace MvvmCross.Core
public virtual void InitializePrimary()
{
if (State != MvxSetupState.Uninitialized) {
if (State != MvxSetupState.Uninitialized)
{
throw new MvxException("Cannot start primary - as state already {0}", State);
}
State = MvxSetupState.InitializingPrimary;
@ -71,7 +75,8 @@ namespace MvvmCross.Core
InitializeLoggingServices();
SetupLog.Trace("Setup: Primary start");
State = MvxSetupState.InitializedPrimary;
if (State != MvxSetupState.InitializedPrimary) {
if (State != MvxSetupState.InitializedPrimary)
{
throw new MvxException("Cannot start seconday - as state is currently {0}", State);
}
State = MvxSetupState.InitializingSecondary;
@ -171,7 +176,8 @@ namespace MvvmCross.Core
protected virtual void PerformBootstrapActions()
{
var bootstrapRunner = new MvxBootstrapRunner();
foreach (var assembly in GetBootstrapOwningAssemblies()) {
foreach (var assembly in GetBootstrapOwningAssemblies())
{
bootstrapRunner.Run(assembly);
}
}
@ -228,7 +234,8 @@ namespace MvvmCross.Core
protected virtual void InitializeLoggingServices()
{
var logProvider = CreateLogProvider();
if (logProvider != null) {
if (logProvider != null)
{
Mvx.RegisterSingleton(logProvider);
SetupLog = logProvider.GetLogFor<MvxSetup>();
var globalLog = logProvider.GetLogFor<MvxLog>();
@ -242,7 +249,8 @@ namespace MvvmCross.Core
protected virtual IMvxLogProvider CreateLogProvider()
{
switch (GetDefaultLogProviderType()) {
switch (GetDefaultLogProviderType())
{
case MvxLogProviderType.Console:
return new ConsoleLogProvider();
case MvxLogProviderType.EntLib:
@ -306,7 +314,8 @@ namespace MvvmCross.Core
.SelectMany(assembly => assembly.GetTypes())
.Where(TypeContainsPluginAttribute);
foreach (var pluginType in pluginTypes) {
foreach (var pluginType in pluginTypes)
{
pluginManager.EnsurePluginLoaded(pluginType);
}
@ -397,7 +406,8 @@ namespace MvvmCross.Core
Mvx.RegisterSingleton(viewModelByNameRegistry);
var viewModelAssemblies = GetViewModelAssemblies();
foreach (var assembly in viewModelAssemblies) {
foreach (var assembly in viewModelAssemblies)
{
viewModelByNameRegistry.AddAll(assembly);
}
@ -480,7 +490,8 @@ namespace MvvmCross.Core
public virtual void EnsureInitialized(Type requiredBy)
{
switch (State) {
switch (State)
{
case MvxSetupState.Uninitialized:
Initialize();
break;