Beispiel #1
0
 public static void Init(FormsApplication application, bool useDeviceIndependentPixel)
 {
     _useDeviceIndependentPixel = useDeviceIndependentPixel;
     SetupInit(application);
 }
Beispiel #2
0
        static void SetupInit(FormsApplication 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;
        }
Beispiel #3
0
 public static void Init(FormsApplication application)
 {
     Init(application, false);
 }