public void Initialize(IServiceProvider services)
            {
#if __ANDROID__ || __IOS__ || WINDOWS || MACCATALYST
                CompatServiceProvider.SetServiceProvider(services);
#endif

                if (services.GetService <IGraphicsService>() is IGraphicsService graphicsService)
                {
                    GraphicsPlatform.RegisterGlobalService(graphicsService);
                }

#if WINDOWS
                var dictionaries = UI.Xaml.Application.Current?.Resources?.MergedDictionaries;
                if (dictionaries != null)
                {
                    // WinUI
                    AddLibraryResources <UI.Xaml.Controls.XamlControlsResources>();

                    // Microsoft.Maui
                    AddLibraryResources("MicrosoftMauiCoreIncluded", "ms-appx:///Microsoft.Maui/Platform/Windows/Styles/Resources.xbf");

                    // Microsoft.Maui.Controls
                    AddLibraryResources("MicrosoftMauiControlsIncluded", "ms-appx:///Microsoft.Maui.Controls/Platform/Windows/Styles/Resources.xbf");

                    // Microsoft.Maui.Controls.Compatibility
                    AddLibraryResources("MicrosoftMauiControlsCompatibilityIncluded", "ms-appx:///Microsoft.Maui.Controls.Compatibility/Windows/Resources.xbf");
                }
#endif
            }
Esempio n. 2
0
        static void Main()
        {
            GraphicsPlatform.RegisterGlobalService(new GDIGraphicsService());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Esempio n. 3
0
        public void Initialize()
        {
            GraphicsPlatform.RegisterGlobalService(DXGraphicsService.Instance);
            GraphicsView.BackgroundColor = Colors.White;

            foreach (var scenario in ScenarioList.Scenarios)
            {
                List.Items.Add(scenario);
            }
            List.SelectionChanged += (source, args) => Drawable = List.SelectedItem as IDrawable;

            List.SelectedIndex = 0;

            this.SizeChanged += (source, args) => Draw();
        }
 public Form1()
 {
     InitializeComponent();
     GraphicsPlatform.RegisterGlobalService(SkiaGraphicsService.Instance);
     skglControl1_SizeChanged(null, null);
 }