예제 #1
0
        public static void Initialize(Type appType, AndroidPlatformOptions options)
        {
            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToTransient <ClipboardImpl>()
            .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>()
            .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>()
            .Bind <IPlatformSettings>().ToConstant(Instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface())
            .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>()
            .Bind <IWindowingPlatform>().ToConstant(Instance)
            .Bind <IPlatformIconLoader>().ToSingleton <PlatformIconLoader>()
            .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>()
            .Bind <IAssetLoader>().ToConstant(new AssetLoader(appType.Assembly));

            SkiaPlatform.Initialize();
            ((global::Android.App.Application)global::Android.App.Application.Context.ApplicationContext)
            .RegisterActivityLifecycleCallbacks(new ActivityTracker());

            if (options.UseGpu)
            {
                EglPlatformOpenGlInterface.TryInitialize();
            }
        }
예제 #2
0
        public static void Initialize(Type appType, AndroidPlatformOptions options)
        {
            Options = options;

            AvaloniaLocator.CurrentMutable
            .Bind <IClipboard>().ToTransient <ClipboardImpl>()
            .Bind <ICursorFactory>().ToTransient <CursorFactory>()
            .Bind <IWindowingPlatform>().ToConstant(new WindowingPlatformStub())
            .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>()
            .Bind <IPlatformSettings>().ToConstant(Instance)
            .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface())
            .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>()
            .Bind <IPlatformIconLoader>().ToSingleton <PlatformIconLoaderStub>()
            .Bind <IRenderTimer>().ToConstant(new ChoreographerTimer())
            .Bind <IRenderLoop>().ToConstant(new RenderLoop())
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>()
            .Bind <IAssetLoader>().ToConstant(new AssetLoader(appType.Assembly));

            SkiaPlatform.Initialize();

            if (options.UseGpu)
            {
                EglPlatformOpenGlInterface.TryInitialize();
            }
        }