Skip to content

Commit

Permalink
InitialzationOption for MauiApp
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiejava committed Aug 26, 2021
1 parent 82cd77c commit 5f8e5fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/Compatibility/Core/src/Tizen/Forms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public struct EffectScope
public string Name;
public ExportEffectAttribute[] Effects;
}
public InitializationOptions()
{
}

public InitializationOptions(CoreApplication application)
{
Expand Down Expand Up @@ -499,6 +502,14 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
Device.SetIdiom(TargetIdiom.Unsupported);
}

if (options != null)
{
s_platformType = options.PlatformType;
s_useMessagingCenter = options.UseMessagingCenter;
UseSkiaSharp = options.UseSkiaSharp;
UseFastLayout = options.UseFastLayout;
}

Application.AccentColor = GetAccentColor(profile);
ExpressionSearch.Default = new TizenExpressionSearch();

Expand Down
12 changes: 11 additions & 1 deletion src/Controls/samples/Controls.Sample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Configure(IAppHostBuilder appBuilder)
#elif WINDOWS
handlers.AddCompatibilityRenderer(typeof(CustomButton),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.UWP.ButtonRenderer));
#elif __TIZEN__
#elif TIZEN
handlers.AddCompatibilityRenderer(typeof(CustomButton),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.Tizen.ButtonRenderer));
#endif
Expand Down Expand Up @@ -91,6 +91,16 @@ public void Configure(IAppHostBuilder appBuilder)
logging.AddConsole();
#endif
});
#if TIZEN
services.AddTransient<InitializationOptions>((_) => {
var option = new InitializationOptions
{
DisplayResolutionUnit = DisplayResolutionUnit.DP(true),
UseSkiaSharp = true
};
return option;
});
#endif
services.AddSingleton<ITextService, TextService>();
services.AddTransient<MainViewModel>();
Expand Down

0 comments on commit 5f8e5fd

Please sign in to comment.