Skip to content

Commit

Permalink
- cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen committed Jun 2, 2021
1 parent 1cb2de4 commit 5dabfc3
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 45 deletions.
1 change: 0 additions & 1 deletion src/Compatibility/Core/src/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public void Configure(HostBuilderContext context, IServiceProvider services)
return;
}

System.Diagnostics.Debug.WriteLine($"controlType: {controlType}");
_handlers?.TryAddHandler(controlType, typeof(RendererToHandlerShim));
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Compatibility/Core/src/Compatibility-net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
</ItemGroup>

<ItemGroup>
<Compile Include="AppHostBuilderExtensions.Controls.cs" />
<Compile Include="RendererToHandlerShim.cs" />
<Compile Include="AppHostBuilderExtensions.cs" />
<Compile Include="MauiHandlersCollectionExtensions.cs" />
Expand Down
5 changes: 1 addition & 4 deletions src/Compatibility/Core/src/Compatibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@
</ItemGroup>

<ItemGroup>
<Compile Include="AppHostBuilderExtensions.Controls.cs">
<SubType>Code</SubType>
<Generator>MSBuild:Compile</Generator>
</Compile>
<Compile Include="AppHostBuilderExtensions.Controls.cs" />
<Compile Include="AppHostBuilderExtensions.cs" />
<Compile Include="MauiHandlersCollectionExtensions.cs" />
<Compile Include="Forms.cs" />
Expand Down
19 changes: 0 additions & 19 deletions src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@ public static IMauiHandlersCollection TryAddCompatibilityRenderer(this IMauiHand
return handlersCollection;
}

public static IMauiHandlersCollection TryAddCompatibilityRenderer<TControlType, TMauiType, TRenderer>(this IMauiHandlersCollection handlersCollection)
where TMauiType : IFrameworkElement
{
FormsCompatBuilder.AddRenderer(typeof(TControlType), typeof(TRenderer));

#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST
handlersCollection.TryAddHandler<TMauiType, RendererToHandlerShim>();
#endif
return handlersCollection;
}

public static IMauiHandlersCollection TryAddCompatibilityRenderer<TControlType, TRenderer>(this IMauiHandlersCollection handlersCollection)
where TControlType : IFrameworkElement
{
handlersCollection.TryAddCompatibilityRenderer<TControlType, TControlType, TRenderer>();

return handlersCollection;
}

public static IMauiHandlersCollection AddCompatibilityRenderer(this IMauiHandlersCollection handlersCollection, Type controlType, Type rendererType)
{
FormsCompatBuilder.AddRenderer(controlType, rendererType);
Expand Down
10 changes: 0 additions & 10 deletions src/Controls/samples/Controls.Sample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ enum PageType { Xaml, Semantics, Main, Blazor, NavigationPage, Shell }

public readonly static bool UseXamlApp = true;
public readonly static bool UseFullDI = false;
public void Configurej(IAppHostBuilder appBuilder)
{
appBuilder
.UseMauiControlsApp<XamlApp>()
.ConfigureServices(services =>
{
services.AddSingleton<ITextService, TextService>();
})
.UseMauiServiceProviderFactory(constructorInjection: true);
}

public void Configure(IAppHostBuilder appBuilder)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static class AppHostBuilderExtensions
{ typeof(Page), typeof(PageHandler) }
};

public static IMauiHandlersCollection AddMauiControlsHandlers(this IMauiHandlersCollection handlersCollection)
internal static IMauiHandlersCollection AddMauiControlsHandlers(this IMauiHandlersCollection handlersCollection)
=> handlersCollection.AddHandlers(DefaultMauiControlHandlers);
}
}
10 changes: 0 additions & 10 deletions src/Controls/src/Core/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.Maui.Controls.StyleSheets;

namespace Microsoft.Maui.Controls
Expand Down Expand Up @@ -391,9 +390,6 @@ public static void RegisterAll(

var length = attributes.Length;

StringBuilder namespaces = new StringBuilder();
StringBuilder renderers = new StringBuilder();

for (var i = 0; i < length; i++)
{
var a = attributes[i];
Expand All @@ -406,17 +402,11 @@ public static void RegisterAll(
{
if (attribute.ShouldRegister())
{
namespaces.AppendLine($"using {attribute.TargetType.Name} = {attribute.TargetType.FullName};");
renderers.AppendLine($"handlers.TryAddCompatibilityRenderer(typeof({attribute.HandlerType.Name}), typeof({attribute.TargetType.Name}));");

Registered.Register(attribute.HandlerType, attribute.TargetType, attribute.SupportedVisuals, attribute.Priority);
viewRegistered?.Invoke(attribute.HandlerType);
}
}
}

System.Diagnostics.Debug.WriteLine(namespaces.ToString());
System.Diagnostics.Debug.WriteLine(renderers.ToString());
}

object[] effectAttributes = assembly.GetCustomAttributesSafe(typeof(ExportEffectAttribute));
Expand Down

0 comments on commit 5dabfc3

Please sign in to comment.