Example #1
0
        public IThemeEditorViewModel NewThemeForScript(IItemFilterScript script)
        {
            var themeComponentCollection = script.ThemeComponents.Aggregate(new ThemeComponentCollection(),
                                                                            (c, component) =>
            {
                switch (component.ComponentType)
                {
                case ThemeComponentType.BackgroundColor:
                case ThemeComponentType.BorderColor:
                case ThemeComponentType.TextColor:
                    c.Add(new ColorThemeComponent(component.ComponentType, component.ComponentName, ((ColorThemeComponent)component).Color));
                    break;

                case ThemeComponentType.FontSize:
                    c.Add(new IntegerThemeComponent(component.ComponentType, component.ComponentName, ((IntegerThemeComponent)component).Value));
                    break;

                case ThemeComponentType.AlertSound:
                    c.Add(new StrIntThemeComponent(component.ComponentType, component.ComponentName, ((StrIntThemeComponent)component).Value, ((StrIntThemeComponent)component).SecondValue));
                    break;
                }
                return(c);
            });

            var themeViewModel = _themeViewModelFactory.Create();

            themeViewModel.InitialiseForNewTheme(themeComponentCollection);
            themeViewModel.FilePath = "Untitled.filtertheme";

            return(themeViewModel);
        }
Example #2
0
        public IThemeEditorViewModel NewThemeForScript(IItemFilterScript script)
        {
            var themeComponentCollection = script.ThemeComponents.Aggregate(new ThemeComponentCollection(),
                                                                            (c, component) =>
            {
                c.Add(new ThemeComponent(component.ComponentType, component.ComponentName, component.Color));
                return(c);
            });

            var themeViewModel = _themeViewModelFactory.Create();

            themeViewModel.InitialiseForNewTheme(themeComponentCollection);
            themeViewModel.FilePath = "Untitled.filtertheme";

            return(themeViewModel);
        }