Exemple #1
0
        //...

        public void Update(string theme)
        {
            BeginInit();
            MergedDictionaries.Clear();

            if (!Enum.TryParse(theme, out DefaultThemes type))
            {
                var result = new ResourceDictionary();
                result.Load(theme);

                if (result != null)
                {
                    MergedDictionaries.Add(result);
                    goto End;
                }
            }
            foreach (var i in DefaultResources)
            {
                var result = new ResourceDictionary
                {
                    Source = i[type]
                };
                MergedDictionaries.Add(result);
            }

End:
            {
                EndInit();
                this.Changed(() => Current);
            }
        }
        internal void LoadContent(ContentManager content, string[] texturePaths, string[] fontPaths, string[] scenePaths)
        {
            textures = new ResourceDictionary<Texture2D>(new ContentResourceLoader<Texture2D>(content));
            fonts = new ResourceDictionary<SpriteFont>(new ContentResourceLoader<SpriteFont>(content));
            scenes = new ResourceDictionary<Scene>(new SceneResourceLoader());

            for (int i = 0; i < texturePaths.Length; i++)
                textures.Load(texturePaths[i]);
            for (int i = 0; i < fontPaths.Length; i++)
                fonts.Load(fontPaths[i]);
            for (int i = 0; i < scenePaths.Length; i++)
                scenes.Load(scenePaths[i]);
        }