protected override void BeginProcessing() { Style style; if (MyInvocation.BoundParameters.ContainsKey("BaseStyle")) { var baseStyle = StyleRegistry.Get(BaseStyle); style = Style.Create(Name, Config, baseStyle); } else { style = Style.Create(Name, Config, StyleRegistry.VanillaStyle); } if (MyInvocation.BoundParameters.ContainsKey("ColorScheme")) { style.ColorScheme = ColorSchemeRegistry.Get(ColorScheme); } if (MyInvocation.BoundParameters.ContainsKey("DefaultFont")) { style.DefaultFont = DefaultFont; } StyleRegistry.Register(style); }
protected override void BeginProcessing() { if (MyInvocation.BoundParameters.ContainsKey("ColorScheme") || MyInvocation.BoundParameters.ContainsKey("DefaultFont")) { var baseName = Style.Value.Name + "-" + ColorScheme + "-" + DefaultFont; var name = baseName; var count = 1; while (ColorSchemeRegistry.Contains(name)) { name = $"{baseName}-{count++}"; } var newStyle = Styles.Style.Create(name, new Dictionary <string, object>(), Style); if (MyInvocation.BoundParameters.ContainsKey("ColorScheme")) { newStyle.ColorScheme = ColorSchemeRegistry.Get(ColorScheme); } if (MyInvocation.BoundParameters.ContainsKey("DefaultFont")) { newStyle.DefaultFont = DefaultFont; } newStyle.Temporary = true; StyleRegistry.DefaultStyle = newStyle; } else { StyleRegistry.DefaultStyle = Style; } }
protected override void BeginProcessing() { if (string.IsNullOrEmpty(Name)) { foreach (var s in ColorSchemeRegistry.ColorSchemes) { WriteObject(s); } } else { var style = ColorSchemeRegistry.Get(Name); WriteObject(style); } }