Exemple #1
0
        private void InitializeComponent()
        {
            // TODO: iOS does not support dynamically loading assemblies
            // so we must refer to this resource DLL statically. For
            // now I am doing that here. But we need a better solution!!
            var theme = new global::Avalonia.Themes.Default.DefaultTheme();

            theme.TryGetResource("Button", out _);
            AvaloniaXamlLoader.Load(this);
        }
Exemple #2
0
        public override void OnFrameworkInitializationCompleted()
        {
            MainThreadInvoker.Current = new AvaloniaMainThreadInvoker();

            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                MainWindow mainWindow = new MainWindow();
                mainWindow.DataContext = new MainWindowViewModel(mainWindow);
                desktop.MainWindow     = mainWindow;
                desktop.ShutdownMode   = ShutdownMode.OnMainWindowClose;
            }

            var builder = new ContainerBuilder();

            builder.RegisterAssemblyModules(this.GetType().Assembly);
            this.container = builder.Build();

            // Not sure why this is here. Is it needed?
            var theme = new global::Avalonia.Themes.Default.DefaultTheme();

            theme.TryGetResource("Button", out _);

            base.OnFrameworkInitializationCompleted();
        }