Ejemplo n.º 1
0
 public TestServices(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowingPlatform windowingPlatform           = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     LayoutManager         = layoutManager;
     Platform              = platform;
     Renderer              = renderer;
     RenderInterface       = renderInterface;
     RenderLoop            = renderLoop;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowingPlatform  = windowingPlatform;
 }
Ejemplo n.º 2
0
        static AvaloniaGlobals()
        {
            RuntimePlatform = new StandardRuntimePlatform();

            var runtime = RuntimePlatform.GetRuntimeInfo();

            if (runtime.OperatingSystem == OperatingSystemType.WinNT)
            {
                Win32Platform.Initialize();
                PlatformThreadingInterface = Win32Platform.Instance;
                WindowingInterface         = Win32Platform.Instance;
                StandardCursorFactory      = CursorFactory.Instance;
            }
            else if (runtime.OperatingSystem == OperatingSystemType.Linux)
            {
                var x11 = new AvaloniaX11Platform();
                x11.Initialize(new X11PlatformOptions());

                WindowingInterface         = x11;
                PlatformThreadingInterface = new X11PlatformThreading(x11);
                StandardCursorFactory      = new X11CursorFactory(x11.Display);
            }
            else
            {
                throw new InvalidOperationException("Unrecognized Operating System");
            }
        }
Ejemplo n.º 3
0
 public TestServices(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     KeyboardNavigation    = keyboardNavigation;
     MouseDevice           = mouseDevice;
     Platform              = platform;
     RenderInterface       = renderInterface;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl         = windowImpl;
     WindowingPlatform  = windowingPlatform;
 }
Ejemplo n.º 4
0
 public TestServices With(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                layoutManager: layoutManager ?? LayoutManager,
                platform: platform ?? Platform,
                renderer: renderer ?? Renderer,
                renderInterface: renderInterface ?? RenderInterface,
                renderLoop: renderLoop ?? RenderLoop,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform));
 }
Ejemplo n.º 5
0
 public TestServices(
     IAssetLoader assetLoader                     = null,
     IInputManager inputManager                   = null,
     ILayoutManager layoutManager                 = null,
     IPclPlatformWrapper platformWrapper          = null,
     IPlatformRenderInterface renderInterface     = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader           = assetLoader;
     InputManager          = inputManager;
     LayoutManager         = layoutManager;
     PlatformWrapper       = platformWrapper;
     RenderInterface       = renderInterface;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl         = windowImpl;
     WindowingPlatform  = windowingPlatform;
 }
Ejemplo n.º 6
0
 public TestServices With(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                keyboardNavigation: keyboardNavigation ?? KeyboardNavigation,
                mouseDevice: mouseDevice ?? MouseDevice,
                platform: platform ?? Platform,
                renderInterface: renderInterface ?? RenderInterface,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform,
                windowImpl: windowImpl ?? WindowImpl));
 }
Ejemplo n.º 7
0
 private static void InitializeWindows()
 {
     Win32Platform.Initialize();
     PlatformThreadingInterface = Win32Platform.Instance;
     WindowingInterface         = Win32Platform.Instance;
     StandardCursorFactory      = CursorFactory.Instance;
 }
Ejemplo n.º 8
0
 public TestServices With(
     IAssetLoader assetLoader                     = null,
     IInputManager inputManager                   = null,
     ILayoutManager layoutManager                 = null,
     IPclPlatformWrapper platformWrapper          = null,
     IPlatformRenderInterface renderInterface     = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                inputManager: inputManager ?? InputManager,
                layoutManager: layoutManager ?? LayoutManager,
                platformWrapper: platformWrapper ?? PlatformWrapper,
                renderInterface: renderInterface ?? RenderInterface,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowImpl: windowImpl ?? WindowImpl,
                windowingPlatform: windowingPlatform ?? WindowingPlatform));
 }
Ejemplo n.º 9
0
 public TestServices(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IPclPlatformWrapper platformWrapper = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader = assetLoader;
     FocusManager = focusManager;
     InputManager = inputManager;
     KeyboardDevice = keyboardDevice;
     LayoutManager = layoutManager;
     PlatformWrapper = platformWrapper;
     RenderInterface = renderInterface;
     StandardCursorFactory = standardCursorFactory;
     Styler = styler;
     Theme = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl = windowImpl;
     WindowingPlatform = windowingPlatform;
 }
Ejemplo n.º 10
0
        private static void InitializeOSX()
        {
            var platform = Native.AvaloniaNativePlatform.Initialize();

            WindowingInterface         = platform;
            PlatformThreadingInterface = new Native.PlatformThreadingInterface(platform.Factory.CreatePlatformThreadingInterface());
            StandardCursorFactory      = new Native.CursorFactory(platform.Factory.CreateCursorFactory());
        }
Ejemplo n.º 11
0
        internal WindowBaseImpl(AvaloniaNativePlatformOptions opts, GlPlatformFeature glFeature)
        {
            _gpu = opts.UseGpu && glFeature != null;
            _deferredRendering = opts.UseDeferredRendering;

            _keyboard      = AvaloniaLocator.Current.GetService <IKeyboardDevice>();
            _mouse         = new MouseDevice();
            _cursorFactory = AvaloniaLocator.Current.GetService <IStandardCursorFactory>();
        }
Ejemplo n.º 12
0
        public WindowBaseImpl(AvaloniaNativePlatformOptions opts)
        {
            _gpu = opts.UseGpu;
            _deferredRendering = opts.UseDeferredRendering;

            _keyboard      = AvaloniaLocator.Current.GetService <IKeyboardDevice>();
            _mouse         = AvaloniaLocator.Current.GetService <IMouseDevice>();
            _cursorFactory = AvaloniaLocator.Current.GetService <IStandardCursorFactory>();
        }
Ejemplo n.º 13
0
        private static void InitializeLinux()
        {
            var x11 = new AvaloniaX11Platform();

            x11.Initialize(new X11PlatformOptions());

            WindowingInterface         = x11;
            PlatformThreadingInterface = new X11PlatformThreading(x11);
            StandardCursorFactory      = new X11CursorFactory(x11.Display);
        }
Ejemplo n.º 14
0
 public TestServices With(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IPclPlatformWrapper platformWrapper = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return new TestServices(
         assetLoader: assetLoader ?? AssetLoader,
         focusManager: focusManager ?? FocusManager,
         inputManager: inputManager ?? InputManager,
         keyboardDevice: keyboardDevice ?? KeyboardDevice,
         layoutManager: layoutManager ?? LayoutManager,
         platformWrapper: platformWrapper ?? PlatformWrapper,
         renderInterface: renderInterface ?? RenderInterface,
         standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
         styler: styler ?? Styler,
         theme: theme ?? Theme,
         threadingInterface: threadingInterface ?? ThreadingInterface,
         windowImpl: windowImpl ?? WindowImpl,
         windowingPlatform: windowingPlatform ?? WindowingPlatform);
 }