Example #1
0
        public Theme(LibraryTheme libraryTheme)
            : this(libraryTheme.Name, libraryTheme.DisplayName, libraryTheme.BaseColorScheme, libraryTheme.ColorScheme, libraryTheme.PrimaryAccentColor, libraryTheme.ShowcaseBrush, libraryTheme.IsRuntimeGenerated, libraryTheme.IsHighContrast)
        {
            if (libraryTheme is null)
            {
                throw new ArgumentNullException(nameof(libraryTheme));
            }

            AddLibraryTheme(libraryTheme);
        }
Example #2
0
        public Theme AddLibraryTheme(LibraryTheme libraryTheme)
        {
            var theme = GetTheme(libraryTheme.Name, libraryTheme.IsHighContrast);

            if (theme is not null)
            {
                theme.AddLibraryTheme(libraryTheme);
                return(theme);
            }

            theme = new Theme(libraryTheme);

            themesInternal.Add(theme);
            return(theme);
        }
Example #3
0
        public Theme AddLibraryTheme(LibraryTheme libraryTheme)
        {
            if (libraryTheme is null)
            {
                throw new ArgumentNullException(nameof(libraryTheme));
            }

            if (libraryTheme.ParentTheme is not null)
            {
                throw new ArgumentException("The theme already has a parent.");
            }

            if (LibraryThemesInternal.Contains(libraryTheme) == false)
            {
                LibraryThemesInternal.Add(libraryTheme);
                libraryTheme.ParentTheme = this;

                Resources.MergedDictionaries.Add(libraryTheme.Resources);
            }

            return(this);
        }
Example #4
0
 public virtual bool MatchesThirdTry(LibraryTheme libraryTheme)
 {
     return(BaseColorScheme == libraryTheme.BaseColorScheme &&
            ShowcaseBrush.ToString() == libraryTheme.ShowcaseBrush.ToString() &&
            IsHighContrast == libraryTheme.IsHighContrast);
 }
Example #5
0
 public virtual bool MatchesSecondTry(LibraryTheme libraryTheme)
 {
     return(BaseColorScheme == libraryTheme.BaseColorScheme &&
            AlternativeColorScheme == libraryTheme.ColorScheme &&
            IsHighContrast == libraryTheme.IsHighContrast);
 }
Example #6
0
 public virtual bool Matches(LibraryTheme libraryTheme)
 {
     return(BaseColorScheme == libraryTheme.BaseColorScheme &&
            ColorScheme == libraryTheme.ColorScheme &&
            IsHighContrast == libraryTheme.IsHighContrast);
 }