Example #1
0
        public Theme([NotNull] 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));
            }

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

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

            theme = new Theme(libraryTheme);

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

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

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

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

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