static void SetupInit(CoreApplication application) { Context = application; if (!IsInitialized) { Internals.Log.Listeners.Add(new XamarinLogListener()); if (System.Threading.SynchronizationContext.Current == null) { TizenSynchronizationContext.Initialize(); } Elementary.Initialize(); Elementary.ThemeOverlay(); } // In .NETCore, AppDomain feature is not supported. // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually. // The assembly of the executing application and referenced assemblies of it are added into the list here. // TODO: AppDomain is comming back in NETStandard2.0. This logic should be changed at that time. TizenPlatformServices.AppDomain.CurrentDomain.RegisterAssemblyRecursively(application.GetType().GetTypeInfo().Assembly); Device.PlatformServices = new TizenPlatformServices();; if (Device.info != null) { ((TizenDeviceInfo)Device.info).Dispose(); Device.info = null; } Device.Info = new Forms.TizenDeviceInfo(); Device.SetFlags(s_flags); if (!Forms.IsInitialized) { Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute) }); } // TODO: We should consider various tizen profiles such as TV, Wearable and so on. 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 { Device.SetIdiom(TargetIdiom.Unsupported); } Color.SetAccent(GetAccentColor(profile)); ExpressionSearch.Default = new TizenExpressionSearch(); IsInitialized = true; }
static void SetupInit(CoreApplication application, InitializationOptions options = null) { Context = application; if (!IsInitialized) { Internals.Log.Listeners.Add(new XamarinLogListener()); if (System.Threading.SynchronizationContext.Current == null) { TizenSynchronizationContext.Initialize(); } Elementary.Initialize(); Elementary.ThemeOverlay(); Utility.AppendGlobalFontPath(@"/usr/share/fonts"); } Device.PlatformServices = new TizenPlatformServices(); if (Device.info != null) { ((TizenDeviceInfo)Device.info).Dispose(); Device.info = null; } Device.Info = new Forms.TizenDeviceInfo(); Device.SetFlags(s_flags); 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); } if (!Forms.IsInitialized) { if (options != null) { s_platformType = options.PlatformType; s_useMessagingCenter = options.UseMessagingCenter; if (options.Assemblies != null && options.Assemblies.Length > 0) { TizenPlatformServices.AppDomain.CurrentDomain.AddAssemblies(options.Assemblies); } // renderers if (options.Handlers != null) { Registrar.RegisterRenderers(options.Handlers); } else { // Add Xamarin.Forms.Core assembly by default to apply the styles. TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(Assembly.GetAssembly(typeof(Xamarin.Forms.View))); // static registrar if (options.StaticRegistarStrategy != StaticRegistrarStrategy.None) { s_staticRegistrarStrategy = options.StaticRegistarStrategy; StaticRegistrar.RegisterHandlers(options.CustomHandlers); if (options.StaticRegistarStrategy == StaticRegistrarStrategy.All) { Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute), typeof(ExportFontAttribute) }); } } else { Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute), typeof(ExportFontAttribute) }); } } // effects var effectScopes = options.EffectScopes; if (effectScopes != null) { for (var i = 0; i < effectScopes.Length; i++) { var effectScope = effectScopes[0]; Registrar.RegisterEffects(effectScope.Name, effectScope.Effects); } } // css Registrar.RegisterStylesheets(options.Flags); } else { // In .NETCore, AppDomain feature is not supported. // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually. // The assembly of the executing application and referenced assemblies of it are added into the list here. TizenPlatformServices.AppDomain.CurrentDomain.RegisterAssemblyRecursively(application.GetType().GetTypeInfo().Assembly); Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute), typeof(ExportFontAttribute) }); } } Color.SetAccent(GetAccentColor(profile)); ExpressionSearch.Default = new TizenExpressionSearch(); if (application is WatchApplication) { s_platformType = PlatformType.Lightweight; } IsInitialized = true; }
static void SetupInit(CoreApplication application, InitializationOptions?maybeOptions = null) { Context = application; if (!IsInitialized) { Internals.Log.Listeners.Add(new XamarinLogListener()); if (System.Threading.SynchronizationContext.Current == null) { TizenSynchronizationContext.Initialize(); } Elementary.Initialize(); Elementary.ThemeOverlay(); } Device.PlatformServices = new TizenPlatformServices(); if (Device.info != null) { ((TizenDeviceInfo)Device.info).Dispose(); Device.info = null; } Device.Info = new Forms.TizenDeviceInfo(); Device.SetFlags(s_flags); if (!Forms.IsInitialized) { if (maybeOptions.HasValue) { var options = maybeOptions.Value; _useDeviceIndependentPixel = options.UseDeviceIndependentPixel; if (options.Assemblies != null) { TizenPlatformServices.AppDomain.CurrentDomain.AddAssemblies(options.Assemblies); } // renderers if (options.Handlers != null) { Registrar.RegisterRenderers(options.Handlers); } else { Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute) }); } // effects var effectScopes = options.EffectScopes; if (effectScopes != null) { for (var i = 0; i < effectScopes.Length; i++) { var effectScope = effectScopes[0]; Registrar.RegisterEffects(effectScope.Name, effectScope.Effects); } } // css var flags = options.Flags; var noCss = (flags & InitializationFlags.DisableCss) != 0; if (!noCss) { Registrar.RegisterStylesheets(); } } else { // In .NETCore, AppDomain feature is not supported. // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually. // The assembly of the executing application and referenced assemblies of it are added into the list here. TizenPlatformServices.AppDomain.CurrentDomain.RegisterAssemblyRecursively(application.GetType().GetTypeInfo().Assembly); Registrar.RegisterAll(new Type[] { typeof(ExportRendererAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportCellAttribute), typeof(ExportHandlerAttribute) }); } } 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; }