using System.Collections;
using System.Collections.Generic;
using System.Text;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
namespace Xamarin.Forms.Internals
{
if (propertyName == null || propertyName == VisualElement.FlowDirectionProperty.PropertyName)
Element.SetFlowDirectionFromParent(element);
- if (propertyName == null || propertyName == VisualElement.VisualProperty.PropertyName)
- Element.SetVisualfromParent(element);
+ if (OptionalFeatureValues.UseVisual)
+ {
+ if (propertyName == null || propertyName == VisualElement.VisualProperty.PropertyName)
+ Element.SetVisualfromParent(element);
+ }
- if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName)
- BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element);
+ if (OptionalFeatureValues.UseShell)
+ {
+ if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName)
+ BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element);
- if (propertyName == null || propertyName == Shell.NavBarHasShadowProperty.PropertyName)
- BaseShellItem.PropagateFromParent(Shell.NavBarHasShadowProperty, element);
+ if (propertyName == null || propertyName == Shell.NavBarHasShadowProperty.PropertyName)
+ BaseShellItem.PropagateFromParent(Shell.NavBarHasShadowProperty, element);
- if (propertyName == null || propertyName == Shell.TabBarIsVisibleProperty.PropertyName)
- BaseShellItem.PropagateFromParent(Shell.TabBarIsVisibleProperty, element);
+ if (propertyName == null || propertyName == Shell.TabBarIsVisibleProperty.PropertyName)
+ BaseShellItem.PropagateFromParent(Shell.TabBarIsVisibleProperty, element);
+ }
foreach (var child in children)
{
using TSystemInfo = Tizen.System.Information;
using ELayout = ElmSharp.Layout;
using DeviceOrientation = Xamarin.Forms.Internals.DeviceOrientation;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
namespace Xamarin.Forms
{
public class InitializationOptions
{
+ public ApplicationLifecycle LifeCycle { get; set; }
public CoreApplication Context { get; set; }
public bool UseDeviceIndependentPixel { get; set; }
public HandlerAttribute[] Handlers { get; set; }
public StaticRegistrarStrategy StaticRegistarStrategy { get; set; }
public PlatformType PlatformType { get; set; }
public bool UseMessagingCenter { get; set; } = true;
+ public bool UseStyle { get; set; } = true;
+ public bool UseShell { get; set; } = true;
+ public bool UseVisual { get; set; } = true;
+
public struct EffectScope
{
Assemblies = assemblies;
}
+ public InitializationOptions(ApplicationLifecycle lifecycle)
+ {
+ LifeCycle = lifecycle;
+ }
+
+ public InitializationOptions(ApplicationLifecycle lifecycle, bool useDeviceIndependentPixel, HandlerAttribute[] handlers)
+ {
+ LifeCycle = lifecycle;
+ UseDeviceIndependentPixel = useDeviceIndependentPixel;
+ Handlers = handlers;
+ }
+
+ public InitializationOptions(ApplicationLifecycle lifecycle, bool useDeviceIndependentPixel, params Assembly[] assemblies)
+ {
+ LifeCycle = lifecycle;
+ UseDeviceIndependentPixel = useDeviceIndependentPixel;
+ Assemblies = assemblies;
+ }
+
public void UseStaticRegistrar(StaticRegistrarStrategy strategy, Dictionary<Type, Func<IRegisterable>> customHandlers=null, bool disableCss=false)
{
StaticRegistarStrategy = strategy;
private set;
}
+ public static bool IsPreloaded
+ {
+ get;
+ private set;
+ }
+
public static DeviceOrientation NaturalOrientation { get; } = GetDeviceOrientation();
public static StaticRegistrarStrategy StaticRegistrarStrategy => s_staticRegistrarStrategy;
}
}
- public static void Init(ApplicationLifecycle lifecycle, bool useDeviceIndependentPixel, Dictionary<Type, Func<IRegisterable>> customHandlers = null)
- {
- if (!IsInitialized)
- {
- Init();
- }
-
- s_useDeviceIndependentPixel = useDeviceIndependentPixel;
-
- if (Device.info != null)
- {
- var info = ((TizenDeviceInfo)Device.info).RefreshByDIP();
- ((TizenDeviceInfo)Device.info).Dispose();
- Device.info = info;
- }
-
- var appAdapter = Context as AdaptedFormsApplication;
- appAdapter.Lifecycle = lifecycle;
- lifecycle.FormsApplication = appAdapter;
-
- if (customHandlers != null)
- StaticRegistrar.RegisterHandlers(customHandlers);
- }
-
static void Init()
{
TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(typeof(View).Assembly);
var appAdapter = new AdaptedFormsApplication();
Init(appAdapter, false);
+ IsPreloaded = true;
}
public static void Init(CoreApplication application)
public static void Init(InitializationOptions options)
{
- SetupInit(options.Context, options);
+ if (!IsInitialized)
+ {
+ var appAdapter = new AdaptedFormsApplication();
+ Context = appAdapter;
+ }
+
+ if (options.LifeCycle != null)
+ {
+ var appAdapter = Context as AdaptedFormsApplication;
+ appAdapter.Lifecycle = options.LifeCycle;
+ options.LifeCycle.FormsApplication = appAdapter;
+ }
+ SetupInit(Context, options);
}
static void SetupInit(CoreApplication application, InitializationOptions options = null)
Elementary.Initialize();
Elementary.ThemeOverlay();
- }
- Device.PlatformServices = new TizenPlatformServices();
- if (Device.info != null)
+ Device.PlatformServices = new TizenPlatformServices();
+ if (Device.info != null)
+ {
+ ((TizenDeviceInfo)Device.info).Dispose();
+ Device.info = null;
+ }
+
+ Device.Info = new Forms.TizenDeviceInfo();
+ Device.SetFlags(s_flags);
+ }
+ else if(Device.info != null)
{
+ var info = ((TizenDeviceInfo)Device.info).RefreshByDIP();
((TizenDeviceInfo)Device.info).Dispose();
- Device.info = null;
+ Device.info = info;
}
- Device.Info = new Forms.TizenDeviceInfo();
- Device.SetFlags(s_flags);
-
- if (!Forms.IsInitialized)
+ if (!Forms.IsInitialized || Forms.IsPreloaded)
{
if (options != null)
{
s_useDeviceIndependentPixel = options.UseDeviceIndependentPixel;
s_platformType = options.PlatformType;
s_useMessagingCenter = options.UseMessagingCenter;
+ OptionalFeatureValues.UseStyle = options.UseStyle;
+ OptionalFeatureValues.UseShell = options.UseShell;
+ OptionalFeatureValues.UseVisual = options.UseVisual;
if (options.Assemblies != null && options.Assemblies.Length > 0)
{
else
{
// Add Xamarin.Forms.Core assembly by default to apply the styles.
- TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(Assembly.GetAssembly(typeof(Xamarin.Forms.View)));
+ if (!Forms.IsPreloaded)
+ {
+ TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(Assembly.GetAssembly(typeof(Xamarin.Forms.View)));
+ }
// static registrar
if (options.StaticRegistarStrategy != StaticRegistrarStrategy.None)
}
}
- string profile = ((TizenDeviceInfo)Device.Info).Profile;
- if (profile == "mobile")
- {
- Device.SetIdiom(TargetIdiom.Phone);
- }
- else if (profile == "tv")
- {
- Device.SetIdiom(TargetIdiom.TV);
- }
- else if (profile == "desktop")
- {
- Device.SetIdiom(TargetIdiom.Desktop);
- }
- else if (profile == "wearable")
- {
- Device.SetIdiom(TargetIdiom.Watch);
- }
- else
+ if (!Forms.IsInitialized)
{
- Device.SetIdiom(TargetIdiom.Unsupported);
+ string profile = ((TizenDeviceInfo)Device.Info).Profile;
+ if (profile == "mobile")
+ {
+ Device.SetIdiom(TargetIdiom.Phone);
+ }
+ else if (profile == "tv")
+ {
+ Device.SetIdiom(TargetIdiom.TV);
+ }
+ else if (profile == "desktop")
+ {
+ Device.SetIdiom(TargetIdiom.Desktop);
+ }
+ else if (profile == "wearable")
+ {
+ Device.SetIdiom(TargetIdiom.Watch);
+ }
+ else
+ {
+ Device.SetIdiom(TargetIdiom.Unsupported);
+ }
+ Color.SetAccent(GetAccentColor(profile));
+ ExpressionSearch.Default = new TizenExpressionSearch();
+ IsInitialized = true;
}
- Color.SetAccent(GetAccentColor(profile));
- ExpressionSearch.Default = new TizenExpressionSearch();
- IsInitialized = true;
}
static Color GetAccentColor(string profile)
[EditorBrowsable(EditorBrowsableState.Never)]
public static void Preload()
{
- Elementary.Initialize();
- Elementary.ThemeOverlay();
var window = new PreloadedWindow();
- TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out int width);
- TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out int height);
-
Forms.Init();
var types = new[]
typeof(TextCell),
typeof(ImageCell),
typeof(SwitchCell),
- typeof(EntryCell)
+ typeof(EntryCell),
+ typeof(VisualElement),
+ typeof(Page),
+ typeof(View),
+ typeof(Element),
+ typeof(NavigableElement),
+ typeof(Layout),
+ typeof(Span),
+ typeof(TapGestureRecognizer),
+ typeof(PropertyCondition)
};
foreach (var type in types)