Beispiel #1
0
        private static AppBuilder CreateApplication(StridePlatformOptions options)
        {
            var builderType     = typeof(AppBuilderBase <>).MakeGenericType(typeof(AppBuilder));
            var configureMethod = builderType.GetMethod(nameof(AppBuilder.Configure), BindingFlags.Public | BindingFlags.Static, null, Array.Empty <Type>(), null);
            var builder         = (AppBuilder)configureMethod.MakeGenericMethod(options.ApplicationType).Invoke(null, Array.Empty <object>());

            builder
            .UseStride();

            switch (GraphicsDevice.Platform)
            {
            default:
                builder.UseSkia();
                break;
            }

            options.ConfigureApp?.Invoke(builder);

            var lifetime = new ClassicDesktopStyleApplicationLifetime
            {
                Args         = Environment.GetCommandLineArgs(),
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            builder.SetupWithLifetime(lifetime);

            return(builder);
        }
Beispiel #2
0
        static AvaloniaManager()
        {
            _initedEvent = new EventWaitHandle(false, EventResetMode.ManualReset);
            _runEvent    = new EventWaitHandle(false, EventResetMode.ManualReset);

            Options = AvaloniaLocator.Current.GetService <StridePlatformOptions>() ?? GetOptions();
            AvaloniaLocator.CurrentMutable.BindToSelf(Options);
        }
 public GenericSkiaRenderer(GenericAvaloniaRenderer generic)
 {
     _data    = generic;
     _options = AvaloniaLocator.Current.GetService <StridePlatformOptions>();
 }