public Style Add(string formatName, string styleClassName, Style style) { if (StyleBuilder.CanBuildStyle(style)) { style.Id = Guid.NewGuid(); if (ExistsKeyInStyleClassAndFormat(formatName, styleClassName, style)) { DeleteStylesSharingKey(formatName, styleClassName, style); StyleRepository.Add(style); } else { style.Format = FormatRepository.GetByName(formatName); style.StyleClass = StyleClassRepository.GetByName(styleClassName); StyleRepository.Add(style); } return(style); } else { throw new InvalidStyleException("This style has an invalid format."); } }
private IEnumerable <Style> GetStylesWithInheritance(StyleClass styleClass, Format format) { List <StyleClass> inheritedClasses = new List <StyleClass>(); StyleClass selectedClass = styleClass; while (selectedClass != null) { inheritedClasses.Add(selectedClass); selectedClass = selectedClass.BasedOn; } List <Style> inheritedStyles = new List <Style>(); for (int i = inheritedClasses.Count - 1; i >= 0; i--) { StyleClass inheritedClass = inheritedClasses.ElementAt(i); List <Style> selectedClassStyles = StyleRepository.GetStyles(inheritedClass.Name, format.Name).ToList(); foreach (Style style in selectedClassStyles) { if (inheritedStyles.Exists(s => s.Key.Equals(style.Key))) { inheritedStyles.RemoveAll(s => s.Key.Equals(style.Key)); } inheritedStyles.Add(style); } } return(inheritedStyles.AsEnumerable()); }
public List <Style> Get() { //return styleRepository.GetAllStyles(); using (var db = new Database1Entities()) { StyleRepository style = new StyleRepository(); return(style.GetAllStyles(db).ToList()); } }
/// <summary> /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class. /// </summary> internal DotvvmConfiguration() { DefaultCulture = CultureInfo.CurrentCulture.Name; Markup = new DotvvmMarkupConfiguration(); RouteTable = new DotvvmRouteTable(this); Resources = new DotvvmResourceRepository(); Security = new DotvvmSecurityConfiguration(); Runtime = new DotvvmRuntimeConfiguration(); Styles = new StyleRepository(this); }
/// <summary> /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class. /// </summary> internal DotvvmConfiguration() { DefaultCulture = CultureInfo.CurrentCulture.Name; Markup = new DotvvmMarkupConfiguration(new Lazy <JavascriptTranslatorConfiguration>(() => ServiceLocator.GetService <IOptions <JavascriptTranslatorConfiguration> >().Value)); RouteTable = new DotvvmRouteTable(this); Resources = new DotvvmResourceRepository(); Security = new DotvvmSecurityConfiguration(); Runtime = new DotvvmRuntimeConfiguration(); Styles = new StyleRepository(this); }
public void Delete(Guid styleId) { if (StyleRepository.ExistsById(styleId)) { Style styleToDelete = StyleRepository.GetById(styleId); StyleRepository.Delete(styleToDelete); } else { throw new MissingStyleException("This style is not in the database"); } }
private void DeleteStylesSharingKey(string formatName, string styleClassName, Style style) { List <Style> allStylesInFormat = GetAll(formatName, styleClassName).ToList(); foreach (Style styleInFormat in allStylesInFormat) { if (styleInFormat.Key.Equals(style.Key)) { StyleRepository.Delete(styleInFormat); } } }
public XmlRepositoryItem(StyleRepository repository) { this.key = repository.Key; this.displayName = repository.Name; this.itemType = repository.ItemType; foreach (PropertySetting setting in repository.Settings) { bool flag = false; foreach (string badItem in XmlRepositoryItem.badItems) { if (badItem == setting.Name) { flag = true; break; } } if (!flag) { string fullName; if (!string.IsNullOrEmpty(setting.FullName)) { fullName = setting.FullName; } else if (setting.Property != null) { fullName = setting.Property.FullName; } else { continue; } if (setting.EndValue != null) { XmlAnimatedPropertySetting animatedPropertySetting = new XmlAnimatedPropertySetting(); animatedPropertySetting.Property = fullName; animatedPropertySetting.Value = setting.Value; animatedPropertySetting.EndValue = setting.EndValue; this.Add((XmlPropertySetting)animatedPropertySetting); } else { this.Add(new XmlPropertySetting() { Property = fullName, Value = setting.Value }); } } } }
public StylingVisitor(StyleRepository styleRepo) : this(styleRepo.CreateMatcher()) { }
/// <summary> /// Initializes a new instance of the <see cref="CategoryStyleController"/> class. /// </summary> public CategoryStyleController() { this.categoryRepository = new CategoryRepository(); this.styleRepository = new StyleRepository(); }
/// <summary> /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class. /// </summary> internal DotvvmConfiguration() { DefaultCulture = Thread.CurrentThread.CurrentCulture.Name; Markup = new DotvvmMarkupConfiguration(); RouteTable = new DotvvmRouteTable(this); Resources = new DotvvmResourceRepository(); Security = new DotvvmSecurityConfiguration(); Runtime = new DotvvmRuntimeConfiguration(); Debug = true; Styles = new StyleRepository(); }
public StyleController() { this.styleRepository = new StyleRepository(); }
public IEnumerable <Style> GetAll(string formatName, string styleClassName) { return(StyleRepository.GetStyles(styleClassName, formatName)); }