Пример #1
0
        private void UpdateSource()
        {
            var requestedVersion = ControlsResourcesVersion;

            if (ControlsResourcesVersion > MaxSupportedResourcesVersion)
            {
                if (this.Log().IsEnabled(LogLevel.Warning))
                {
                    this.Log().LogWarning($"" +
                                          $"WinUI resources version {ControlsResourcesVersion} is not supported " +
                                          $"in Uno Platform yet. Falling back to {MaxSupportedResourcesVersion} styles.");
                }
                requestedVersion = MaxSupportedResourcesVersion;
            }

            switch (requestedVersion)
            {
            case ControlsResourcesVersion.Version1:
#if !__NETSTD_REFERENCE__
                Uno.UI.FluentTheme.v1.GlobalStaticResources.Initialize();
                Uno.UI.FluentTheme.v1.GlobalStaticResources.RegisterDefaultStyles();
                Uno.UI.FluentTheme.v1.GlobalStaticResources.RegisterResourceDictionariesBySource();
#endif
                break;

            case ControlsResourcesVersion.Version2:
#if !__NETSTD_REFERENCE__
                Uno.UI.FluentTheme.v2.GlobalStaticResources.Initialize();
                Uno.UI.FluentTheme.v2.GlobalStaticResources.RegisterDefaultStyles();
                Uno.UI.FluentTheme.v2.GlobalStaticResources.RegisterResourceDictionariesBySource();
#endif
                break;
            }


            Source = new Uri(XamlFilePathHelper.AppXIdentifier + XamlFilePathHelper.GetWinUIThemeResourceUrl((int)requestedVersion));

            _isUsingResourcesVersion2 = requestedVersion == ControlsResourcesVersion.Version2;
        }
Пример #2
0
 private void UpdateSource()
 {
     Source = new Uri(XamlFilePathHelper.AppXIdentifier + XamlFilePathHelper.GetWinUIThemeResourceUrl(1));
 }