Пример #1
0
        protected void InitPerspex(Type appType)
        {
            if (_initialized)
            {
                return;
            }
            _initialized = true;

            var window     = new UIWindow(UIScreen.MainScreen.Bounds);
            var controller = new PerspexViewController(window);

            window.RootViewController = controller;
            window.MakeKeyAndVisible();

            Application.RegisterPlatformCallback(() =>
            {
                MouseDevice    = new MouseDevice();
                KeyboardDevice = new KeyboardDevice();
                SharedPlatform.Register(appType.Assembly);
                PerspexLocator.CurrentMutable
                .Bind <IClipboard>().ToTransient <Clipboard>()
                //.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
                .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>()
                .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice)
                .Bind <IMouseDevice>().ToConstant(MouseDevice)
                .Bind <IPlatformSettings>().ToSingleton <PlatformSettings>()
                .Bind <IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance)
                .Bind <IWindowImpl>().ToConstant(controller.PerspexView);
                SkiaPlatform.Initialize();
            });
        }
Пример #2
0
        protected void InitPerspex(Type appType)
        {
            if(_initialized)
                return;
            _initialized = true;
            
            var window = new UIWindow(UIScreen.MainScreen.Bounds);
            var controller = new PerspexViewController(window);
            window.RootViewController = controller;
            window.MakeKeyAndVisible();

            Application.RegisterPlatformCallback(() =>
            {
                MouseDevice = new MouseDevice();
                KeyboardDevice = new KeyboardDevice();
                SharedPlatform.Register(appType.Assembly);
                PerspexLocator.CurrentMutable
                    .Bind<IClipboard>().ToTransient<Clipboard>()
                    //.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
                    .Bind<IStandardCursorFactory>().ToTransient<CursorFactory>()
                    .Bind<IKeyboardDevice>().ToConstant(KeyboardDevice)
                    .Bind<IMouseDevice>().ToConstant(MouseDevice)
                    .Bind<IPlatformSettings>().ToSingleton<PlatformSettings>()
                    .Bind<IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance)
                    .Bind<IWindowingPlatform>().ToConstant(new WindowingPlatform(controller.PerspexView));
                SkiaPlatform.Initialize();
            });
        }