コード例 #1
0
        public void SetStandard()
        {
            var themeManager = ApplicationThemeManager.Instance;

            AccentColor           = themeManager.AccentColors.First(x => x.Name == "Blue");
            AppTheme              = themeManager.AppThemes.First(x => x.Name == "BaseLight");
            ApplicationBackground = null;
            AudioVisualisation    = DefaultAudioVisualisation.GetDefault();
        }
コード例 #2
0
        public void Refresh()
        {
            _accentColors        = new ObservableCollection <AccentColorBase>();
            _appThemes           = new ObservableCollection <AppThemeBase>();
            _themePacks          = new ObservableCollection <ThemePack>();
            _audioVisualisations = new ObservableCollection <IAudioVisualisationContainer>();

            foreach (var t in ThemeManager.Accents.Select(a => new AccentColor {
                Name = a.Name
            }).OrderBy(x => x.TranslatedName))
            {
                _accentColors.Add(t);
            }

            foreach (var t in ThemeManager.AppThemes.Select(a => new AppTheme {
                Name = a.Name
            }).OrderBy(x => x.TranslatedName))
            {
                _appThemes.Add(t);
            }

            _audioVisualisations.Add(DefaultAudioVisualisation.GetDefault());

            var accentColorsFolder = new DirectoryInfo(HurricaneSettings.Instance.AccentColorsDirectory);

            if (accentColorsFolder.Exists)
            {
                foreach (var file in accentColorsFolder.GetFiles("*.xaml"))
                {
                    CustomAccentColor theme;

                    if (CustomAccentColor.FromFile(file.FullName, out theme))
                    {
                        _accentColors.Add(theme);
                    }
                }
            }

            var appThemesFolder = new DirectoryInfo(HurricaneSettings.Instance.AppThemesDirectory);

            if (appThemesFolder.Exists)
            {
                foreach (var file in appThemesFolder.GetFiles("*.xaml"))
                {
                    CustomAppTheme theme;
                    if (CustomAppTheme.FromFile(file.FullName, out theme))
                    {
                        _appThemes.Add(theme);
                    }
                }
            }

            var themePacksFolder = new DirectoryInfo(HurricaneSettings.Instance.ThemePacksDirectory);

            if (themePacksFolder.Exists)
            {
                foreach (var file in themePacksFolder.GetFiles("*.htp"))
                {
                    ThemePack pack;
                    if (ThemePack.FromFile(file.FullName, out pack))
                    {
                        _themePacks.Add(pack);
                    }
                }
            }

            var audioVisualisations = new DirectoryInfo(HurricaneSettings.Instance.AudioVisualisationsDirectory);

            if (audioVisualisations.Exists)
            {
                foreach (var file in audioVisualisations.GetFiles("*.dll"))
                {
                    _audioVisualisations.Add(new CustomAudioVisualisation {
                        FileName = file.Name
                    });
                }
            }
        }