public ThemeService(IThemeRules rules, IGetUserDTO getUserDTO, IUOWFactory dataFactory, IForumDTOHelper forumHelper) { GetUserService = getUserDTO; DataFactory = dataFactory; forumDTOHelper = forumHelper; ThemeRules = rules; }
public CreateThemeValidator(IThemeRules themeRules) : base(themeRules) { _themeRules = themeRules; RuleFor(c => c.Id) .NotEmpty().WithMessage("Id is required.") .Must(HaveUniqueId).WithMessage("A theme with the same id already exists."); }
public CreateThemeValidator(IThemeRules themeRules) : base(themeRules) { _themeRules = themeRules; RuleFor(c => c.Id) .Must(HaveUniqueId).WithMessage("A theme with the same id already exists.") .When(x => x.Id != Guid.Empty); }
public ThemeController(IDispatcher dispatcher, IThemeRules themeRules, IContextService contextService) : base(contextService) { _dispatcher = dispatcher; _themeRules = themeRules; }
public ForumDTOHelper(IMessageRules messageRules, IThemeRules themeRules, ISectionRules sectionRules, IGroupRules groupRules, IDTOHelper dtoHelper) { MessageRules = messageRules; ThemeRules = themeRules; SectionRules = sectionRules; GroupRules = groupRules; DTOHelper = dtoHelper; }
public ThemeController(IThemeFacade themeFacade, ICommandSender commandSender, IThemeRules themeRules, IContextService contextService) : base(contextService) { _themeFacade = themeFacade; _commandSender = commandSender; _themeRules = themeRules; }
public ThemeController(ICommandSender commandSender, IQueryDispatcher queryDispatcher, IThemeRules themeRules, IContextService contextService) : base(contextService) { _commandSender = commandSender; _queryDispatcher = queryDispatcher; _themeRules = themeRules; }
/// <summary> /// Sets the color of each slot based on its rule. Slots that don't inherit must have a color already. /// If this completes without error, then the theme is ready to use. (All slots will have a color.) /// setSlot() can be called before this, but this must be called before getThemeAs*(). /// Does not override colors of rules where isCustomized is true (i.e. doesn't override existing customizations). /// </summary> /// <param name="slotRules"></param> /// <param name="isInverted"></param> public static void InsureSlots(IThemeRules slotRules, Boolean isInverted) { // Get all the "root" rules, the ones which don't inherit. Then "set" them to trigger updating dependent slots. foreach (var ruleName in slotRules) { IThemeSlotRule rule = slotRules[ruleName]; if (rule.inherits == null && String.IsNullOrEmpty(rule.value)) { if (rule.color == null) { throw new InvalidOperationException("A color slot rule that does not inherit must provide its own color."); } ThemeGenerator.SetSlotInternal(rule, rule.color, isInverted, false, false); } } }
/// <summary> /// Gets the JSON-formatted blob that describes the theme, usable with the REST request endpoints /// { [theme slot name as string] : [color as string], /// "tokenName": "#f00f00", /// "tokenName2": "#ba2ba2", /// ... } /// </summary> /// <param name="slotRules"></param> public static string GetThemeAsJson(IThemeRules slotRules) { var theme = new Dictionary <string, string>(); foreach (var ruleName in slotRules) { // strip out the unnecessary shade slots from the final output theme if (ruleName.IndexOf("ColorShade") == -1 && ruleName != BaseSlots.primaryColor.ToString() && ruleName != BaseSlots.backgroundColor.ToString() && ruleName != BaseSlots.foregroundColor.ToString()) { IThemeSlotRule rule = slotRules[ruleName]; theme[rule.name] = (rule.color != null) ? rule.color.str : rule.value; } } var json = Newtonsoft.Json.JsonConvert.SerializeObject(theme); return(json); }
public ThemeDetailsValidator(IThemeRules themeRules) { _themeRules = themeRules; RuleFor(c => c.Name) .NotEmpty().WithMessage("Theme name is required.") .Length(1, 100).WithMessage("Theme name length must be between 1 and 100 characters.") .Must(HaveUniqueName).WithMessage("A theme with the same name already exists."); RuleFor(c => c.Description) .Length(1, 250).WithMessage("Culture name length must be between 1 and 250 characters.") .When(c => !string.IsNullOrWhiteSpace(c.Description)); RuleFor(c => c.Folder) .NotEmpty().WithMessage("Theme folder is required.") .Length(1, 100).WithMessage("Theme url length must be between 1 and 100 characters.") .Must(HaveValidThemeFolder).WithMessage("Theme folder is not valid. Enter only letters and 1 hyphen.") .Must(HaveUniqueThemeFolder).WithMessage("A theme with the same folder already exists."); }
public TemplateDetailsValidator(ITemplateRules templateRules, IThemeRules themeRules) { _templateRules = templateRules; _themeRules = themeRules; RuleFor(c => c.ThemeId) .NotEmpty().WithMessage("Theme is required.") .Must(HaveValidTheme).WithMessage("Theme does not exist."); RuleFor(c => c.Name) .NotEmpty().WithMessage("Template name is required.") .Length(1, 100).WithMessage("Template name length must be between 1 and 100 characters.") .Must(HaveUniqueName).WithMessage("A template with the same name already exists."); RuleFor(c => c.Description) .Length(1, 250).WithMessage("Culture name length must be between 1 and 250 characters.") .When(c => !string.IsNullOrWhiteSpace(c.Description)); RuleFor(c => c.ViewName) .NotEmpty().WithMessage("Template view name is required.") .Length(1, 250).WithMessage("Template view name length must be between 1 and 250 characters.") .Must(HaveValidTemplateViewName).WithMessage("Template url is not valid. Enter only letters and 1 hyphen.") .Must(HaveUniqueTemplateViewName).WithMessage("A template with the same url already exists."); }
public UpdateTemplateDetailsValidator(ITemplateRules templateRules, IThemeRules themeRules) : base(templateRules, themeRules) { }
public UpdateThemeDetailsValidator(IThemeRules themeRules) : base(themeRules) { }
public MessageRules(IThemeRules themeRules, ISectionRules sectionRules) { ThemeRules = themeRules; SectionRules = sectionRules; }