Beispiel #1
0
        static UnoXamlHostBase()
        {
            //TODO: These lines should be set in a different location, possibly in a more general way (for multi-window support) https://github.com/unoplatform/uno/issues/8978
            Windows.UI.Core.CoreDispatcher.DispatchOverride = d =>
                                                              global::System.Windows.Application.Current.Dispatcher.BeginInvoke(d);
            Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride =
                global::System.Windows.Application.Current.Dispatcher.CheckAccess;
            if (MetadataProviderDiscovery.MetadataProviderFactory is null)
            {
                MetadataProviderDiscovery.MetadataProviderFactory = type =>
                {
                    if (typeof(WUX.Application).IsAssignableFrom(type))
                    {
                        WUX.Application application = null;

                        WUX.Application.Start(_ =>
                        {
                            application = (WUX.Application)Activator.CreateInstance(type);
                        });

                        return((WUX.Markup.IXamlMetadataProvider)application);
                    }

                    return(null);
                };
            }

            _metadataContainer = XamlApplicationExtensions.GetOrCreateXamlMetadataContainer();
        }
 static WindowsXamlHostBase()
 {
     _metadataContainer = XamlApplicationExtensions.GetOrCreateXamlMetadataContainer();
 }