예제 #1
0
        public void ExecuteRecipeStep(RecipeContext recipeContext)
        {
            if (!String.Equals(recipeContext.RecipeStep.Name, "ThemeSettings", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            foreach (var themeElement in recipeContext.RecipeStep.Step.Elements())
            {
                var themeName = themeElement.Attr <string>("Name");

                foreach (var profileElement in themeElement.Elements())
                {
                    var profileName = profileElement.Attr <string>("Name");
                    var profile     = _themeSettingsService.GetProfile(profileName) ?? new ThemeProfile();

                    profile.Name        = profileElement.Attr <string>("Name");
                    profile.Description = profileElement.Attr <string>("Description");
                    profile.Theme       = themeName;
                    profile.IsCurrent   = profileElement.Attr <bool>("IsCurrent");
                    profile.Settings    = _themeSettingsService.DeserializeSettings(profileElement.Value);

                    _themeSettingsService.SaveProfile(profile);
                }
            }

            recipeContext.Executed = true;
        }
예제 #2
0
        public override void Execute(RecipeExecutionContext context)
        {
            foreach (var themeElement in context.RecipeStep.Step.Elements())
            {
                var themeName = themeElement.Attr <string>("Name");

                foreach (var profileElement in themeElement.Elements())
                {
                    var profileName = profileElement.Attr <string>("Name");
                    var profile     = _themeSettingsService.GetProfile(profileName) ?? new ThemeProfile();

                    profile.Name        = profileElement.Attr <string>("Name");
                    profile.Description = profileElement.Attr <string>("Description");
                    profile.Theme       = themeName;
                    profile.IsCurrent   = profileElement.Attr <bool>("IsCurrent");
                    profile.Settings    = _themeSettingsService.DeserializeSettings(profileElement.Value);

                    _themeSettingsService.SaveProfile(profile);
                }
            }
        }