/// <summary> /// Setup all necessary to later render the shop templates. /// </summary> /// <param name="theme"></param> /// <param name="templateName"></param> /// <param name="layout"></param> /// <param name="template"></param> public void PrepareRenderTemplate(ITheme theme, string templateName, out Template layout, out Template template) { IThemeItem layoutItem; IThemeItem templateItem; if (ViewBag.Unpublished != null) { layoutItem = theme.GetUnpublishedItem("layout.liquid", "layouts"); templateItem = theme.GetUnpublishedItem(templateName, "templates"); } else { layoutItem = theme.GetItem("layout.liquid", "layouts"); templateItem = theme.GetItem(templateName, "templates"); } Template.FileSystem = new Llprk.Web.UI.Areas.Store.Controllers.LiquidFileSystem(theme, ViewBag.Unpublished ?? false); Template.RegisterFilter(typeof(ScriptTagFilter)); Template.RegisterFilter(typeof(StylesheetTagFilter)); Template.RegisterFilter(typeof(ImageUrlFilter)); // Template lesen. TODO: Cache. layout = Template.Parse(layoutItem.ReadContent()); template = Template.Parse(templateItem.ReadContent()); // Render Template. template.Registers.Add("file_system", Template.FileSystem); }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var componentNameGroup = match.Groups["componentName"]; if (componentNameGroup == null) return ""; var componentName = componentNameGroup.Value; var component = context.Filter(_components.Where(x => x.GetType().Name == componentName), theme).FirstOrDefault(); if (component == null) return ""; var settings = component.GetDefaultSettings(); var settingsGroup = match.Groups["settings"]; if (!string.IsNullOrEmpty(settingsGroup?.Value)) { var settingsJson = settingsGroup.Value; if (!string.IsNullOrEmpty(settingsJson)) { var parsedSettings = JsonConvert.DeserializeObject<IDictionary<string, object>>(settingsJson); foreach (var item in parsedSettings) settings[item.Key] = item.Value; } } var renderResult = cmsRenderer.RenderComponent(component, settings, context, theme); return recurse(renderResult.Read()); }
public async Task LoadTheme(ITheme theme) { if (_currentTheme == theme) { return; } var hadThemePrior = false; if (_currentTheme != null) { if (string.Equals(_currentTheme.Name, theme.Name)) { return; } UnloadThemeInternal(_currentTheme); hadThemePrior = true; } _logger.Info("Loading theme: {0}", theme.Name); LoadThemeInternal(theme); if (hadThemePrior) { // TODO: Figure out how to determine when this has completed await Task.Delay(10); } EventHelper.FireEventIfNotNull(ThemeLoaded, this, new ItemEventArgs<ITheme> { Argument = theme }, _logger); }
/// <summary> /// Creates a new <see cref="ResourceDictionary"/> /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public ResourceDictionary CreateResourceDictionary(ITheme theme) { if (theme == null) throw new ArgumentNullException(nameof(theme)); var res = CreateResourceDictionary(); var isBold = GetIsBold(theme); if (isBold != null) res.Add(IsBoldId, isBold.Value); var isItalic = GetIsItalic(theme); if (isItalic != null) res.Add(IsItalicId, isItalic.Value); var fg = GetForeground(theme); if (fg != null) { res[ForegroundBrushId] = fg; if (fg.Opacity != 1) res[ForegroundOpacityId] = fg.Opacity; } var bg = GetBackground(theme); if (bg != null) { res[BackgroundBrushId] = bg; if (bg.Opacity != 1) res[BackgroundOpacityId] = bg.Opacity; } return res; }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var localizationNamespace = _findCurrentLocalizationNamespace.Find(); var key = !string.IsNullOrEmpty(localizationNamespace) ? string.Format("{0}:{1}", localizationNamespace, match.Groups["resource"].Value) : match.Groups["resource"].Value; var replacements = new Dictionary<string, string>(); var replacementsGroup = match.Groups["replacements"]; if (replacementsGroup != null && !string.IsNullOrEmpty(replacementsGroup.Value)) { var replacementsData = replacementsGroup .Value .Split(',') .Where(x => !string.IsNullOrEmpty(x)) .Select(x => x.Split(':')) .Where(x => x.Length > 1 && !string.IsNullOrEmpty(x[0]) && !string.IsNullOrEmpty(x[1])) .ToList(); foreach (var item in replacementsData) replacements[item[0]] = item[1]; } var localized = _localizeText.Localize(key, _findCultureForRequest.FindUiCulture()); localized = replacements.Aggregate(localized, (current, replacement) => current.Replace(string.Concat("{{", replacement.Key, "}}"), replacement.Value)); return recurse(localized); }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var templateNameGroup = match.Groups["templateName"]; if (templateNameGroup == null) return ""; var templateName = templateNameGroup.Value; var template = _templateStorage.Load(templateName, theme); if (template == null) return ""; var settings = new Dictionary<string, object>(); var settingsGroup = match.Groups["settings"]; if (settingsGroup != null && !string.IsNullOrEmpty(settingsGroup.Value)) { var settingsJson = settingsGroup.Value; if (!string.IsNullOrEmpty(settingsJson)) { var parsedSettings = JsonConvert.DeserializeObject<IDictionary<string, object>>(settingsJson); foreach (var item in parsedSettings) settings[item.Key] = item.Value; } } var renderResult = cmsRenderer.RenderTemplate(template, settings, context, theme); return renderResult.Read(); }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var contextNameGroup = match.Groups["contextName"]; if (contextNameGroup == null || string.IsNullOrEmpty(contextNameGroup.Value)) return ""; var path = match.Groups["contextName"].Value; var parts = path.Split('.'); var contextName = parts.FirstOrDefault(); var requestContext = context.FindContext(contextName); if (requestContext == null) return null; var settingsName = parts.Skip(1).FirstOrDefault(); if (!requestContext.Data.ContainsKey(settingsName)) return null; var value = _findParameterValueFromModel.Find(path.Substring(string.Format("{0}.{1}.", contextName, settingsName).Length), requestContext.Data[settingsName]); var stringValue = value as string; return stringValue != null ? recurse(stringValue) : value; }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">The other.</param> /// <returns></returns> public bool Equals(ITheme other) { if (other == null) return false; return Name == other.Name; }
public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme) { m_visualTheme = visualTheme; this.bandwidthBox.ThemeChanged(visualTheme); this.ignoreBeginningBox.ThemeChanged(visualTheme); this.ignoreEndBox.ThemeChanged(visualTheme); this.boxCategory.ThemeChanged(visualTheme); }
public static string ThemePath(this HtmlHelper helper, ITheme theme, string path) { Control parent = helper.ViewDataContainer as Control; Argument.ThrowIfNull(parent, "helper.ViewDataContainer"); return parent.ResolveUrl(helper.Resolve<IExtensionManager>().GetThemeLocation(theme) + path); }
public CmsEndpointConfiguration Load(string endpoint, ITheme theme) { return new CmsEndpointConfiguration { Settings = new Dictionary<string, object>(), EndpointName = endpoint, Theme = theme.GetName() }; }
public override IRenderResult RenderComponent(ICmsComponent component, IDictionary<string, object> settings, ICmsContext context, ITheme theme) { var result = component.Render(context, settings) as TextRenderInformation; if(result == null) return new RenderResult("", ""); return new RenderResult(result.ContentType, result.Text); }
public bool AddTheme(ITheme theme) { if (!_themeDictionary.ContainsKey(theme.Name)) { _themeDictionary.Add(theme.Name, theme); Themes.Add(theme); return true; } return false; }
//-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- #region Initialize /// <summary> /// monitor the log file for changes, set up the initial read /// </summary> /// <param name="filePath"></param> /// <param name="siteFileWatcherService"></param> public void Initialize(string logDirectory, ISiteFileWatcherService siteFileWatcherService, ITheme theme) { _logDirectory = new DirectoryInfo(logDirectory); _siteFileWatcherService = siteFileWatcherService; _siteFileWatcherService.RegisterForSiteNotifications(WatcherChangeTypes.Created | WatcherChangeTypes.Changed, new FileSystemEventHandler(FileSystemEvent), null); //outy.Foreground = theme.DefaultFormat.ForeColor; //outy.Background = theme.DefaultFormat.BackColor; }
public AccumulatedSummaryView() { m_visualTheme = #if ST_2_1 Plugin.GetApplication().VisualTheme; #else Plugin.GetApplication().SystemPreferences.VisualTheme; #endif InitializeComponent(); }
public static IHtmlString Component(this IFubuPage page, ICmsComponent component, IDictionary<string, object> settings = null, ITheme theme = null) { var cmsRenderer = page.ServiceLocator.GetInstance<ICmsRenderer>(); var cmsContext = page.ServiceLocator.GetInstance<ICmsContext>(); theme = theme ?? cmsContext.GetCurrentTheme(); var result = cmsRenderer.RenderComponent(component, settings ?? new Dictionary<string, object>(), cmsContext, theme); return new HtmlString(result.Read()); }
public bool AddTheme(ITheme theme) { if (!ThemeDictionary.ContainsKey(theme.Name)) { //theme.UriList.Add(new Uri("pack://application:,,,/Wide.Core;component/Styles/MenuResource.xaml")); ThemeDictionary.Add(theme.Name, theme); Themes.Add(theme); return true; } return false; }
static string GetThemeHeaderName(ITheme theme) { if (theme.Guid == ThemeConstants.THEME_HIGHCONTRAST_GUID) return dnSpy_Resources.Theme_HighContrast; if (theme.Guid == ThemeConstants.THEME_BLUE_GUID) return dnSpy_Resources.Theme_Blue; if (theme.Guid == ThemeConstants.THEME_DARK_GUID) return dnSpy_Resources.Theme_Dark; if (theme.Guid == ThemeConstants.THEME_LIGHT_GUID) return dnSpy_Resources.Theme_Light; return theme.MenuName; }
public string Parse(string text, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var hash = CalculateHash(text); var template = ParsedTemplates.Get(hash, x => Template.Parse(text)); var contexts = context .FindCurrentContexts() .ToDictionary(x => x.Name, x => (object)x.Data); return template.Render(Hash.FromDictionary(contexts)); }
public void ThemeChanged(ITheme visualTheme) { this.txtFilename.ThemeChanged(visualTheme); this.txtYSize.ThemeChanged(visualTheme); this.txtXSize.ThemeChanged(visualTheme); this.panelCustom.ThemeChanged(visualTheme); this.isSaveIn.ThemeChanged(visualTheme); this.txtSaveIn.ThemeChanged(visualTheme); //Non ST controls this.splitContainer1.Panel1.BackColor = visualTheme.Control; this.splitContainer1.Panel2.BackColor = visualTheme.Control; }
/// <summary> /// monitor the log file for changes, set up the initial read /// </summary> /// <param name="filePath"></param> /// <param name="siteFileWatcherService"></param> public void Initialize(string filePath, ISiteFileWatcherService siteFileWatcherService, ITheme theme) { _filePath = Path.GetFullPath(filePath); _siteFileWatcherService = siteFileWatcherService; if (File.Exists(_filePath)) this.PerformInitialRead(); _siteFileWatcherService.RegisterForSiteNotifications(WatcherChangeTypes.All, new FileSystemEventHandler(FileSystemEvent), null); outy.Foreground = theme.DefaultFormat.ForeColor; outy.Background = theme.DefaultFormat.BackColor; }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { var markdownParser = new Markdown(new MarkdownOptions { AutoNewLines = true }); var mardown = match.Groups[1].Value; if (string.IsNullOrEmpty(mardown)) return mardown; return markdownParser.Transform(mardown); }
private void LoadThemeInternal(ITheme theme) { _themeResources = theme.GetResources().ToList(); var presentationManager = _presentationManager(); foreach (var resource in _themeResources) { presentationManager.AddResourceDictionary(resource); } theme.Load(); _currentTheme = theme; }
/// <summary> /// Creates a new <see cref="ResourceDictionary"/> /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public ResourceDictionary CreateResourceDictionary(ITheme theme) { if (theme == null) throw new ArgumentNullException(nameof(theme)); var res = CreateResourceDictionary(); var fg = GetForeground(theme); if (fg != null) res[ForegroundBrushId] = fg; var bg = GetBackground(theme); if (bg != null) res[BackgroundBrushId] = bg; return res; }
/// <summary> /// Constructor sets up the menu and sets the required properties /// in order thay this may be displayed over the top of it's parent /// form. /// </summary> private ActiveMenuImpl(Form form) { InitializeComponent(); items = new ActiveItemsImpl(); items.CollectionModified += ItemsCollectionModified; parentForm = form; Show(form); parentForm.Disposed += ParentFormDisposed; Visible = false; isActivated = form.WindowState != FormWindowState.Minimized; themeFactory = new ThemeFactory(form); theme = themeFactory.GetTheme(); originalMinSize = form.MinimumSize; AttachHandlers(); ToolTip.ShowAlways = true; TopMost = form.TopMost; TopMost = false; spillOverMode = SpillOverMode.IncreaseSize; }
public static IHtmlString ParseText(this IFubuPage page, string text, ParseTextOptions options = null, ITheme theme = null) { try { var cmsRenderer = page.ServiceLocator.GetInstance<ICmsRenderer>(); var cmsContext = page.ServiceLocator.GetInstance<ICmsContext>(); theme = theme ?? cmsContext.GetCurrentTheme(); var result = cmsRenderer.ParseText(text, cmsContext, theme, options); return new HtmlString(result.Read()); } catch (Exception ex) { var logger = page.ServiceLocator.GetInstance<Logger>(); logger.Error(ex, "Failed parsing text!"); return new HtmlString(text); } }
public string Parse(string text, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse) { text = text ?? ""; text = GetRegexes().Aggregate(text, (current, regex) => regex.Replace(current, x => { var value = FindParameterValue(x, cmsRenderer, context, theme, recurse); if (value == null) return ""; var enumerableValue = value as IEnumerable; if (enumerableValue != null && !(value is string)) { var stringValues = enumerableValue.OfType<object>().Select(y => y.ToString()).ToList(); return string.Join(SeperateListItemsWith, stringValues); } return value.ToString(); })); return text; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); switch (buttons) { case null: buttonExt1.Visible = buttonExt2.Visible = buttonExt3.Visible = false; break; case MessageBoxButtons.AbortRetryIgnore: buttonExt1.DialogResult = DialogResult.Ignore; buttonExt1.Text = "Ignore".Tx(this); buttonExt2.DialogResult = DialogResult.Retry; buttonExt2.Text = "Retry".Tx(this); buttonExt3.DialogResult = DialogResult.Abort; buttonExt3.Text = "Abort".Tx(this); this.AcceptButton = buttonExt2; this.CancelButton = buttonExt3; break; case MessageBoxButtons.OKCancel: buttonExt1.DialogResult = DialogResult.Cancel; buttonExt1.Text = "Cancel".Tx(this); buttonExt2.DialogResult = DialogResult.OK; buttonExt2.Text = "OK".Tx(this); buttonExt3.Visible = false; this.AcceptButton = buttonExt2; this.CancelButton = buttonExt1; break; case MessageBoxButtons.RetryCancel: buttonExt1.DialogResult = DialogResult.Cancel; buttonExt1.Text = "Cancel".Tx(this); buttonExt2.DialogResult = DialogResult.OK; buttonExt2.Text = "Retry".Tx(this); buttonExt3.Visible = false; this.AcceptButton = buttonExt2; this.CancelButton = buttonExt1; break; case MessageBoxButtons.YesNo: buttonExt1.DialogResult = DialogResult.No; buttonExt1.Text = "No".Tx(this); buttonExt2.DialogResult = DialogResult.Yes; buttonExt2.Text = "Yes".Tx(this); buttonExt3.Visible = false; break; case MessageBoxButtons.YesNoCancel: buttonExt1.DialogResult = DialogResult.Cancel; buttonExt1.Text = "Cancel".Tx(this); buttonExt2.DialogResult = DialogResult.No; buttonExt2.Text = "No".Tx(this); buttonExt3.DialogResult = DialogResult.Yes; buttonExt3.Text = "Yes".Tx(this); this.AcceptButton = this.CancelButton = buttonExt1; break; case MessageBoxButtons.OK: default: buttonExt1.DialogResult = DialogResult.OK; buttonExt1.Text = "OK".Tx(this); buttonExt2.Visible = false; buttonExt3.Visible = false; this.AcceptButton = this.CancelButton = buttonExt1; break; } Image iconselected = null; // If not null, this icon will be drawn on the left of this form. Set from mbIcon in OnLoad switch (mbIcon) { // case MessageBoxIcon.Information: case MessageBoxIcon.Asterisk: iconselected = SystemIcons.Asterisk.ToBitmap(); break; // case MessageBoxIcon.Exclamation: case MessageBoxIcon.Warning: iconselected = SystemIcons.Warning.ToBitmap(); break; // case MessageBoxIcon.Error: // case MessageBoxIcon.Stop: case MessageBoxIcon.Hand: iconselected = SystemIcons.Hand.ToBitmap(); break; case MessageBoxIcon.Question: iconselected = SystemIcons.Question.ToBitmap(); break; case MessageBoxIcon.None: default: break; } if (iconselected != null) { panelIcon.Width = iconselected.Width; panelIcon.Height = iconselected.Height; panelLeft.Width = panelIcon.Right + 8; panelIcon.BackgroundImage = iconselected; } else { panelLeft.Width = 4; } ITheme theme = ThemeableFormsInstance.Instance; bool framed = true; if (theme != null) // paranoid { framed = theme.ApplyStd(this); themeTextBox.TextBoxBackColor = this.BackColor; // text box back is form back in this circumstance - we don't want it to stand out. if (theme.MessageBoxWindowIcon != null) { this.Icon = theme.MessageBoxWindowIcon; } } else { this.Font = BaseUtils.FontLoader.GetFont("MS Sans Serif", 12.0F); this.ForeColor = Color.Black; } labelCaption.Visible = !framed; themeTextBox.BorderStyle = BorderStyle.None; themeTextBox.BorderColor = Color.Transparent; themeTextBox.ReadOnly = true; focusholder = new RichTextBox(); focusholder.Location = new Point(20000, 10000); // impossible, as of 2019.. Controls.Add(focusholder); focusholder.Focus(); // easy way to move the flashing caret from the primary rich text box - it does not seem to have a cursor off }
public static void SetMahApps(this ResourceDictionary resourceDictionary, ITheme theme, BaseTheme baseTheme) { resourceDictionary.SetMahAppsBaseTheme(baseTheme); resourceDictionary.SetBrush("Theme.ShowcaseBrush", new SolidColorBrush(theme.SecondaryMid.Color)); resourceDictionary.SetColor("MahApps.Colors.Highlight", theme.PrimaryMid.Color); resourceDictionary.SetColor("MahApps.Colors.AccentBase", theme.SecondaryDark.Color); resourceDictionary.SetColor("MahApps.Colors.Accent", theme.SecondaryMid.Color); resourceDictionary.SetColor("MahApps.Colors.Accent2", theme.SecondaryMid.Color); resourceDictionary.SetColor("MahApps.Colors.Accent3", theme.SecondaryLight.Color); resourceDictionary.SetColor("MahApps.Colors.Accent4", theme.SecondaryLight.Color); resourceDictionary.SetColor("MahApps.Colors.ProgressIndeterminate1", Color.FromArgb(0x33, 0x87, 0x87, 0x87)); resourceDictionary.SetColor("MahApps.Colors.ProgressIndeterminate2", Color.FromArgb(0x33, 0x95, 0x95, 0x95)); resourceDictionary.SetColor("MahApps.Colors.ProgressIndeterminate3", Color.FromArgb(0x4C, 0x00, 0x00, 0x00)); resourceDictionary.SetColor("MahApps.Colors.ProgressIndeterminate4", Color.FromArgb(0x4C, 0x00, 0x00, 0x00)); resourceDictionary.SetBrush("MahApps.Brushes.Control.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.White", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.Black", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.Text", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.Label.Text", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.WhiteColor", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.BlackColor", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.WindowTitle", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.WindowTitle.NonActive", Color.FromRgb(0x80, 0x80, 0x80)); resourceDictionary.SetBrush("MahApps.Brushes.Border.NonActive", Color.FromRgb(0x80, 0x80, 0x80)); resourceDictionary.SetBrush("MahApps.Brushes.Highlight", (Color)resourceDictionary["MahApps.Colors.Highlight"]); resourceDictionary.SetBrush("MahApps.Brushes.DisabledWhite", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.TransparentWhite", Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF)); resourceDictionary.SetBrush("MahApps.Brushes.SemiTransparentWhite", Color.FromArgb(0x55, 0xFF, 0xFF, 0xFF)); resourceDictionary.SetBrush("MahApps.Brushes.SemiTransparentGray", Color.FromArgb(0x40, 0x80, 0x80, 0x80)); resourceDictionary.SetBrush("MahApps.Brushes.Controls.Disabled", Color.FromArgb(0xA5, 0xFF, 0xFF, 0xFF)); resourceDictionary.SetBrush("MahApps.Brushes.AccentBase", (Color)resourceDictionary["MahApps.Colors.AccentBase"]); resourceDictionary.SetBrush("MahApps.Brushes.Accent", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.Accent2", (Color)resourceDictionary["MahApps.Colors.Accent2"]); resourceDictionary.SetBrush("MahApps.Brushes.Accent3", (Color)resourceDictionary["MahApps.Colors.Accent3"]); resourceDictionary.SetBrush("MahApps.Brushes.Accent4", (Color)resourceDictionary["MahApps.Colors.Accent4"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray1", (Color)resourceDictionary["MahApps.Colors.Gray1"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray2", (Color)resourceDictionary["MahApps.Colors.Gray2"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray3", (Color)resourceDictionary["MahApps.Colors.Gray3"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray4", (Color)resourceDictionary["MahApps.Colors.Gray4"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray5", (Color)resourceDictionary["MahApps.Colors.Gray5"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray6", (Color)resourceDictionary["MahApps.Colors.Gray6"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray7", (Color)resourceDictionary["MahApps.Colors.Gray7"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray8", (Color)resourceDictionary["MahApps.Colors.Gray8"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray9", (Color)resourceDictionary["MahApps.Colors.Gray9"]); resourceDictionary.SetBrush("MahApps.Brushes.Gray10", (Color)resourceDictionary["MahApps.Colors.Gray10"]); resourceDictionary.SetBrush("MahApps.Brushes.GrayNormal", (Color)resourceDictionary["MahApps.Colors.GrayNormal"]); resourceDictionary.SetBrush("MahApps.Brushes.GrayHover", (Color)resourceDictionary["MahApps.Colors.GrayHover"]); resourceDictionary.SetBrush("MahApps.Brushes.TextBox.Border", (Color)resourceDictionary["MahApps.Colors.Gray6"]); resourceDictionary.SetBrush("MahApps.Brushes.Controls.Border", (Color)resourceDictionary["MahApps.Colors.Gray6"]); resourceDictionary.SetBrush("MahApps.Brushes.TextBox.MouseOverInnerBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.TextBox.FocusBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.TextBox.MouseOverBorder", (Color)resourceDictionary["MahApps.Colors.Gray2"]); resourceDictionary.SetBrush("MahApps.Brushes.Button.MouseOverBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.Button.MouseOverInnerBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.ComboBox.MouseOverBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.ComboBox.MouseOverInnerBorder", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.ComboBox.PopupBorder", (Color)resourceDictionary["MahApps.Colors.Gray4"]); resourceDictionary.SetBrush("MahApps.Brushes.CheckBox", (Color)resourceDictionary["MahApps.Colors.Gray6"]); resourceDictionary.SetBrush("MahApps.Brushes.CheckBox.MouseOver", (Color)resourceDictionary["MahApps.Colors.Gray2"]); resourceDictionary.SetBrush("MahApps.Brushes.CheckBox.Background", new LinearGradientBrush { StartPoint = new Point(0.5, 0), EndPoint = new Point(0.5, 1), GradientStops = new GradientStopCollection { new GradientStop((Color)resourceDictionary["MahApps.Colors.Gray7"], 0), new GradientStop((Color)resourceDictionary["MahApps.Colors.White"], 1) } }); resourceDictionary.SetBrush("MahApps.Brushes.Thumb", (Color)resourceDictionary["MahApps.Colors.Gray5"]); resourceDictionary.SetBrush("MahApps.Brushes.Progress", new LinearGradientBrush { StartPoint = new Point(1.002, 0.5), EndPoint = new Point(0.001, 0.5), GradientStops = new GradientStopCollection { new GradientStop((Color)resourceDictionary["MahApps.Colors.Highlight"], 0), new GradientStop((Color)resourceDictionary["MahApps.Colors.Accent3"], 1) } }); resourceDictionary.SetBrush("MahApps.Brushes.SliderValue.Disabled", (Color)resourceDictionary["MahApps.Colors.SliderValue.Disabled"]); resourceDictionary.SetBrush("MahApps.Brushes.SliderTrack.Disabled", (Color)resourceDictionary["MahApps.Colors.SliderTrack.Disabled"]); resourceDictionary.SetBrush("MahApps.Brushes.SliderThumb.Disabled", (Color)resourceDictionary["MahApps.Colors.SliderThumb.Disabled"]); resourceDictionary.SetBrush("MahApps.Brushes.SliderTrack.Hover", (Color)resourceDictionary["MahApps.Colors.SliderTrack.Hover"]); resourceDictionary.SetBrush("MahApps.Brushes.SliderTrack.Normal", (Color)resourceDictionary["MahApps.Colors.SliderTrack.Normal"]); resourceDictionary.SetBrush("MahApps.Brushes.Flyout.Background", (Color)resourceDictionary["MahApps.Colors.Flyout"]); resourceDictionary.SetBrush("MahApps.Brushes.Flyout.Foreground", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.Window.FlyoutOverlay", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.Window.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.Separator", Color.FromArgb(0xFF, 0xC4, 0xC4, 0xC5)); resourceDictionary.SetBrush("MahApps.Brushes.FlatButton.Background", Color.FromRgb(0xD5, 0xD5, 0xD5)); resourceDictionary.SetBrush("MahApps.Brushes.FlatButton.Foreground", Color.FromRgb(0x22, 0x22, 0x22)); resourceDictionary.SetBrush("MahApps.Brushes.FlatButton.PressedBackground", (Color)resourceDictionary["MahApps.Colors.FlatButton.PressedBackground"]); resourceDictionary.SetBrush("MahApps.Brushes.FlatButton.PressedForeground", Colors.White); resourceDictionary.SetBrush("MahApps.Brushes.DarkIdealForegroundDisabled", Color.FromRgb(0xAD, 0xAD, 0xAD)); resourceDictionary.SetBrush("MahApps.Brushes.CleanWindowCloseButton.Background", Color.FromRgb(0xEB, 0x2F, 0x2F)); resourceDictionary.SetBrush("MahApps.Brushes.CleanWindowCloseButton.PressedBackground", Color.FromRgb(0x7C, 0x00, 0x00)); //CONTROL VALIDATION BRUSHES resourceDictionary.SetBrush("MahApps.Brushes.Controls.Validation", Color.FromArgb(0xFF, 0xDB, 0x00, 0x0C)); resourceDictionary.SetBrush("MahApps.Brushes.Validation1", Color.FromArgb(0x05, 0x2A, 0x2E, 0x31)); resourceDictionary.SetBrush("MahApps.Brushes.Validation2", Color.FromArgb(0x15, 0x2A, 0x2E, 0x31)); resourceDictionary.SetBrush("MahApps.Brushes.Validation3", Color.FromArgb(0x25, 0x2A, 0x2E, 0x31)); resourceDictionary.SetBrush("MahApps.Brushes.Validation4", Color.FromArgb(0x35, 0x2A, 0x2E, 0x31)); resourceDictionary.SetBrush("MahApps.Brushes.Validation5", Color.FromArgb(0xFF, 0xDC, 0x00, 0x0C)); //unused resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummary1", Color.FromArgb(0xFF, 0xDC, 0x02, 0x0D)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummary2", Color.FromArgb(0xFF, 0xCA, 0x00, 0x0C)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummary3", Color.FromArgb(0xFF, 0xFF, 0x92, 0x98)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummary4", Color.FromArgb(0xFF, 0xFD, 0xC8, 0xC8)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummary5", Color.FromArgb(0xDD, 0xD4, 0x39, 0x40)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummaryFill1", Color.FromArgb(0x59, 0xF7, 0xD8, 0xDB)); resourceDictionary.SetBrush("MahApps.Brushes.ValidationSummaryFill2", Color.FromArgb(0xFF, 0xF7, 0xD8, 0xDB)); //validation text foreground always white resourceDictionary.SetBrush("MahApps.Brushes.Text.Validation", Colors.White); //WPF default colors resourceDictionary.SetBrush("{x:Static SystemColors.WindowBrushKey}", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("{x:Static SystemColors.ControlTextBrushKey}", (Color)resourceDictionary["MahApps.Colors.Black"]); //menu default colors resourceDictionary.SetBrush("MahApps.Brushes.Menu.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.ContextMenu.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.SubMenu.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.MenuItem.Background", (Color)resourceDictionary["MahApps.Colors.White"]); resourceDictionary.SetBrush("MahApps.Brushes.ContextMenu.Border", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.SubMenu.Border", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.MenuItem.SelectionFill", (Color)resourceDictionary["MahApps.Colors.MenuItem.SelectionFill"]); resourceDictionary.SetBrush("MahApps.Brushes.MenuItem.SelectionStroke", (Color)resourceDictionary["MahApps.Colors.MenuItem.SelectionStroke"]); resourceDictionary.SetBrush("MahApps.Brushes.TopMenuItem.PressedFill", (Color)resourceDictionary["MahApps.Colors.TopMenuItem.PressedFill"]); resourceDictionary.SetBrush("MahApps.Brushes.TopMenuItem.PressedStroke", (Color)resourceDictionary["MahApps.Colors.TopMenuItem.PressedStroke"]); resourceDictionary.SetBrush("MahApps.Brushes.TopMenuItem.SelectionStroke", (Color)resourceDictionary["MahApps.Colors.TopMenuItem.SelectionStroke"]); resourceDictionary.SetBrush("MahApps.Brushes.MenuItem.DisabledForeground", (Color)resourceDictionary["MahApps.Colors.MenuItem.DisabledForeground"]); resourceDictionary.SetBrush("MahApps.Brushes.MenuItem.DisabledGlyphPanel", Color.FromRgb(0x84, 0x85, 0x89)); resourceDictionary.SetBrush("{x:Static SystemColors.MenuTextBrushKey}", (Color)resourceDictionary["MahApps.Colors.Black"]); resourceDictionary.SetBrush("MahApps.Brushes.CheckmarkFill", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.RightArrowFill", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetColor("MahApps.Colors.IdealForeground", theme.PrimaryMid.GetForegroundColor()); resourceDictionary.SetBrush("MahApps.Brushes.IdealForeground", theme.PrimaryMid.GetForegroundColor()); resourceDictionary.SetBrush("MahApps.Brushes.IdealForegroundDisabled", (Color)resourceDictionary["MahApps.Colors.IdealForeground"]); resourceDictionary.SetBrush("MahApps.Brushes.AccentSelectedColor", (Color)resourceDictionary["MahApps.Colors.IdealForeground"]); //DataGrid brushes resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.Highlight", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.DisabledHighlight", (Color)resourceDictionary["MahApps.Colors.Gray7"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.HighlightText", (Color)resourceDictionary["MahApps.Colors.IdealForeground"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.MouseOverHighlight", (Color)resourceDictionary["MahApps.Colors.Accent3"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.FocusBorder", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.InactiveSelectionHighlight", (Color)resourceDictionary["MahApps.Colors.Accent2"]); resourceDictionary.SetBrush("MahApps.Brushes.DataGrid.InactiveSelectionHighlightText", (Color)resourceDictionary["MahApps.Colors.IdealForeground"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.Pressed.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.Pressed.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OffBorder.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.OffBorder.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OffMouseOverBorder.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.OffMouseOverBorder.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OffDisabledBorder.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.OffDisabledBorder.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OffSwitch.Win10", Colors.Transparent); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OnSwitch.Win10", (Color)resourceDictionary["MahApps.Colors.Accent"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OnSwitchDisabled.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.OnSwitchDisabled.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.OnSwitchMouseOver.Win10", (Color)resourceDictionary["MahApps.Colors.Accent2"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.ThumbIndicator.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.ThumbIndicator.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.ThumbIndicatorMouseOver.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.ThumbIndicatorMouseOver.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.ThumbIndicatorChecked.Win10", (Color)resourceDictionary["MahApps.Colors.IdealForeground"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.ThumbIndicatorPressed.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.ThumbIndicatorPressed.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.ToggleSwitchButton.ThumbIndicatorDisabled.Win10", (Color)resourceDictionary["MahApps.Colors.ToggleSwitchButton.ThumbIndicatorDisabled.Win10"]); resourceDictionary.SetBrush("MahApps.Brushes.Badged.DisabledBackground", (Color)resourceDictionary["MahApps.Colors.Badged.DisabledBackground"]); //HamburgerMenu resourceDictionary.SetBrush("MahApps.HamburgerMenu.PaneBackground", Color.FromArgb(0xFF, 0x44, 0x44, 0x44)); resourceDictionary.SetBrush("MahApps.HamburgerMenu.PaneForeground", Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF)); }
public void OnThemeChange(ITheme oldTheme, ITheme newTheme) { ThemeChanged?.Invoke(this, new ThemeChangedEventArgs(_ResourceDictionary, oldTheme, newTheme)); }
/// <summary> /// Initializes a new instance of the <see cref="StyleTransform"/> class. /// </summary> /// <param name="theme"> /// The theme. /// </param> public StyleTransform(ITheme theme) { this._theme = theme; }
public ICollection <IRule> CreateGlobalCss(ITheme theme) { var spinnerRules = new HashSet <IRule>(); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner" }, Properties = new CssString() { Css = $"display:flex;" + "flex-direction:column;" + "align-items:center;" + "justify-content:center;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--top" }, Properties = new CssString() { Css = $"flex-direction:column-reverse;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--left" }, Properties = new CssString() { Css = $"flex-direction:row-reverse;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--right" }, Properties = new CssString() { Css = "flex-direction:row;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner-circle" }, Properties = new CssString() { Css = $"box-sizing:border-box;" + $"border-radius:50%;" + $"border:1.5px solid {theme.Palette.ThemeLight};" + $"border-top-color:{theme.Palette.ThemePrimary};" + $"animation-name:spinAnimation;" + $"animation-duration:1.3s;" + $"animation-iteration-count:infinite;" + $"animation-timing-function:cubic-bezier(.53,.21,.29,.67);" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--xSmall" }, Properties = new CssString() { Css = $"width:12px;" + $"height:12px;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--small" }, Properties = new CssString() { Css = $"width:16px;" + $"height:16px;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--medium" }, Properties = new CssString() { Css = $"width:20px;" + $"height:20px;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--large" }, Properties = new CssString() { Css = $"width:28px;" + $"height:28px;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@media screen and (-ms-high-contrast: active)" }, Properties = new CssString() { Css = ".ms-Spinner-circle{border-top-color:Highlight;}" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner-label" }, Properties = new CssString() { Css = $"font-size:{theme.FontStyle.FontSize.Small};" + $"font-weight:{theme.FontStyle.FontWeight.Regular};" + $"color:{theme.Palette.ThemePrimary};" + $"margin:8px 0 0 0;" + $"text-align:center;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--top .ms-Spinner-label" }, Properties = new CssString() { Css = $"margin: 0 0 8px 0;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--right .ms-Spinner-label" }, Properties = new CssString() { Css = $"margin: 0 0 0 8px;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner--left .ms-Spinner-label" }, Properties = new CssString() { Css = $"margin: 0 8px 0 0;" } }); //Label enable && unchecked spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Spinner-screenReaderText" }, Properties = new CssString() { Css = $"position:absolute;" + "width:1px;" + "height:1px;" + "margin:-1px;" + "padding:0;" + "border:0;" + "overflow:hidden;" } }); spinnerRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@keyframes spinAnimation" }, Properties = new CssString() { Css = "0%{transform: rotate(0deg);} 100%{transform:rotate(360deg);}" } }); return(spinnerRules); }
/// <summary> /// Gets the background opacity or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual double?GetBackgroundOpacity(ITheme theme) => null;
private static void DrawSegment(VectorLayer segmentsLayer, INetworkCoverage coverage, ITheme theme, int segmentNumber, IList <double> allBranchLocationValues, bool firstSegment, bool lastSegment, Graphics graphics, INetworkSegment segment, VectorStyle defaultStyle, double offset) { var valueAtStart = allBranchLocationValues[segmentNumber * 2]; var value = allBranchLocationValues[segmentNumber * 2 + 1]; var valueAtEnd = allBranchLocationValues[segmentNumber * 2 + 2]; // extract based on valueAtStart and valueAtEnd the colors from the var styleStart = (theme != null) ? (VectorStyle)theme.GetStyle(valueAtStart) : segmentsLayer.Style; var themeStyle = (theme != null) ? (VectorStyle)theme.GetStyle(value) : segmentsLayer.Style; var styleEnd = (theme != null) ? (VectorStyle)theme.GetStyle(valueAtEnd) : segmentsLayer.Style; if (firstSegment && lastSegment) { // 1 segment; render segement based on coverage.Locations.InterpolationType if (coverage.Locations.ExtrapolationType == ExtrapolationType.None) { VectorRenderingHelper.RenderGeometry(graphics, segmentsLayer.Map, segment.Geometry, defaultStyle, null, true); return; } if (coverage.Locations.ExtrapolationType == ExtrapolationType.Linear) { VectorRenderingHelper.RenderGeometry(graphics, segmentsLayer.Map, segment.Geometry, themeStyle, null, true); return; } // todo use proper colors/styles from Theme; now 'via' styles are ignored. var kcolors = new[] { ((SolidBrush)styleStart.Fill).Color, ((SolidBrush)themeStyle.Fill).Color, ((SolidBrush)styleEnd.Fill).Color }; var kpositions = new[] { 0.0F, (float)((offset - segment.Offset) / segment.Length), 1.0F }; DrawStrokesLinear(graphics, Transform.TransformToImage((ILineString)segment.Geometry, segmentsLayer.Map), (int)themeStyle.Line.Width, kcolors, kpositions); return; } var positions = new[] { 0.0F, (float)((offset - segment.Offset) / segment.Length), (float)((offset - segment.Offset) / segment.Length), 1.0F }; var colors = CreateBeginEndColors(coverage, firstSegment, lastSegment, GetStyleColor(themeStyle), GetStyleColor(styleStart), GetStyleColor(styleEnd), GetStyleColor(defaultStyle)); // todo use proper colors/styles from Theme; now 'via' styles are ignored. if (!segment.Geometry.IsEmpty) { DrawStrokesLinear(graphics, Transform.TransformToImage((ILineString)segment.Geometry, segmentsLayer.Map), (int)themeStyle.Line.Width, colors, positions); } }
public ICollection <IRule> CreateGlobalCss(ITheme theme) { var detailsRowRules = new HashSet <IRule>(); var focusProps = new FocusStyleProps(theme); var focusStyles = FocusStyle.GetFocusStyle(focusProps, ".ms-DetailsRow-check"); detailsRowRules.Add( new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-check" }, Properties = new CssString() { Css = $"font-size:{theme.FontStyle.FontSize.Small};" + $"font-weight:{theme.FontStyle.FontWeight.Regular};" + focusStyles.MergeRules + $"display:flex;" + $"align-items:center;" + $"justify-content:center;" + $"cursor:default;" + $"box-sizing:border-box;" + $"vertical-align:top;" + $"background:none;" + $"background-color:transparent;" + $"border:none;" + $"opacity:0;" + $"height:42px;" + $"width:48px;" + $"padding:0px;" + $"margin:0px;" } }); detailsRowRules.Add( new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-compact .ms-DetailsRow-check" }, Properties = new CssString() { Css = "height:32px;" } }); detailsRowRules.Add( new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-header .ms-DetailsRow-check" }, Properties = new CssString() { Css = "height:42px;" } }); detailsRowRules.Add( new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-check.is-checked,.ms-DetailsRow-check.is-visible" }, Properties = new CssString() { Css = "opacity:1;" } }); return(detailsRowRules); }
public static Func <ExportContext, SharpKml.Dom.Style> CreateFromSharpmapTheme(ITheme theme) { if (theme == null) { throw new ArgumentNullException("theme"); } return(context => { var sharpmapStyle = theme.GetStyle(context.Feature); return sharpmapStyle != null?CreateFromSharpmapStyle(sharpmapStyle)(context) : null; }); }
/// <summary> /// Gets the font rendering em size or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual double?GetFontRenderingEmSize(ITheme theme) => null;
/// <summary> /// Builds an <see cref="ADrawable" /> for this component. /// </summary> /// <param name="theme"> /// The theme. /// </param> /// <returns> /// The <see cref="ADrawable" /> handle. /// </returns> protected override ADrawable BuildHandler(ITheme theme) { return(theme.BuildSliderButtonHandler(this)); }
// lab sets the items, def can be less or null public static List <string> ShowDialog(Form p, string caption, Icon ic, string[] lab, string[] def, bool multiline = false, string[] tooltips = null) { ITheme theme = ThemeableFormsInstance.Instance; int vstart = theme.WindowsFrame ? 20 : 40; int vspacing = multiline ? 80 : 40; int lw = 100; int lx = 10; int tx = 10 + lw + 8; Form prompt = new Form() { Width = 600, Height = 90 + vspacing * lab.Length + (theme.WindowsFrame ? 20 : 0), FormBorderStyle = FormBorderStyle.FixedDialog, Text = caption, StartPosition = FormStartPosition.CenterScreen, Icon = ic }; Panel outer = new Panel() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle }; prompt.Controls.Add(outer); Label textLabel = new Label() { Left = lx, Top = 8, Width = prompt.Width - 50, Text = caption }; if (!theme.WindowsFrame) { outer.Controls.Add(textLabel); } Label[] lbs = new Label[lab.Length]; ExtendedControls.TextBoxBorder[] tbs = new ExtendedControls.TextBoxBorder[lab.Length]; ToolTip tt = new ToolTip(); tt.ShowAlways = true; int y = vstart; for (int i = 0; i < lab.Length; i++) { lbs[i] = new Label() { Left = lx, Top = y, Width = lw, Text = lab[i] }; tbs[i] = new ExtendedControls.TextBoxBorder() { Left = tx, Top = y, Width = prompt.Width - 50 - tx, Text = (def != null && i < def.Length) ? def[i] : "", Multiline = multiline, // set before height! Height = vspacing - 20, ScrollBars = (multiline) ? ScrollBars.Vertical : ScrollBars.None, WordWrap = multiline }; outer.Controls.Add(lbs[i]); outer.Controls.Add(tbs[i]); if (tooltips != null && i < tooltips.Length) { tt.SetToolTip(lbs[i], tooltips[i]); tbs[i].SetTipDynamically(tt, tooltips[i]); // no container here, set tool tip on text boxes using this } y += vspacing; } ExtendedControls.ButtonExt confirmation = new ExtendedControls.ButtonExt() { Text = "Ok".Tx(), Left = tbs[0].Right - 80, Width = 80, Top = y, DialogResult = DialogResult.OK }; outer.Controls.Add(confirmation); confirmation.Click += (sender, e) => { prompt.Close(); }; ExtendedControls.ButtonExt cancel = new ExtendedControls.ButtonExt() { Text = "Cancel".Tx(), Left = confirmation.Location.X - 90, Width = 80, Top = confirmation.Top, DialogResult = DialogResult.Cancel }; outer.Controls.Add(cancel); cancel.Click += (sender, e) => { prompt.Close(); }; if (!multiline) { prompt.AcceptButton = confirmation; } prompt.CancelButton = cancel; prompt.ShowInTaskbar = false; theme.ApplyToFormStandardFontSize(prompt); if (prompt.ShowDialog(p) == DialogResult.OK) { var r = (from ExtendedControls.TextBoxBorder t in tbs select t.Text).ToList(); return(r); } else { return(null); } }
public Notebook(ITheme newTheme) { this.notes = new List <Note>(); groupTheme = newTheme; }
public ICollection <IRule> CreateGlobalCss(ITheme theme) { //DetailsRowLocalRules.Clear(); var detailsRowRules = new HashSet <IRule>(); // Root var rootFocusStyleProps = new FocusStyleProps(theme); rootFocusStyleProps.BorderColor = theme.SemanticColors.FocusBorder; rootFocusStyleProps.OutlineColor = theme.Palette.White; var rootMergeStyleResults = FocusStyle.GetFocusStyle(rootFocusStyleProps, ".ms-DetailsRow"); foreach (var rule in rootMergeStyleResults.AddRules) { detailsRowRules.Add(rule); } detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow" }, Properties = new CssString() { Css = $"font-size:{theme.FontStyle.FontSize.Small};" + $"font-weight:{theme.FontStyle.FontWeight.Regular};" + rootMergeStyleResults.MergeRules + $"border-bottom:1px solid {theme.Palette.NeutralLighter};" + $"background:{theme.Palette.White};" + $"color:{theme.Palette.NeutralSecondary};" + $"display:inline-flex;" + $"min-width:100%;" + $"width:100%;" + // added to make DetailsRow fit width of window $"min-height:{RowHeight}px;" + $"white-space:nowrap;" + $"padding:0px;" + $"box-sizing:border-box;" + $"vertical-align:top;" + $"text-align:left;" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-compact" }, Properties = new CssString() { Css = $"min-height:{CompactRowHeight}px;" + "border:0px" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow:hover" }, Properties = new CssString() { Css = $"background:{theme.Palette.NeutralLighter};" + $"color:{theme.Palette.NeutralPrimary}" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow:hover .is-row-header" }, Properties = new CssString() { Css = $"color:{theme.Palette.NeutralDark}" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow:hover .ms-DetailsRow-check" }, Properties = new CssString() { Css = $"opacity:1;" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-Fabric--isFocusVisible .ms-DetailsRow:focus .ms-DetailsRow-check" }, Properties = new CssString() { Css = $"opacity:1;" } }); var rootSelectedFocusStyleProps = new FocusStyleProps(theme); rootSelectedFocusStyleProps.BorderColor = theme.SemanticColors.FocusBorder; rootSelectedFocusStyleProps.OutlineColor = theme.Palette.White; var rootSelectedMergeStyleResults = FocusStyle.GetFocusStyle(rootSelectedFocusStyleProps, ".ms-DetailsRow.is-selected"); foreach (var rule in rootSelectedMergeStyleResults.AddRules) { detailsRowRules.Add(rule); } detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-selected" }, Properties = new CssString() { Css = rootSelectedMergeStyleResults.MergeRules + $"color:{theme.Palette.NeutralDark};" + $"background:{theme.Palette.NeutralLight};" + $"border-bottom:1px solid {theme.Palette.White};" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-selected:before" }, Properties = new CssString() { Css = $"position:absolute;" + $"display:block;" + $"top:-1px;" + $"height:1px;" + $"bottom:0px;" + $"left:0px;" + $"right:0px;" + $"content:'';" + $"border-top:1px solid {theme.Palette.White}" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-selected:hover" }, Properties = new CssString() { Css = $"background:{theme.Palette.NeutralQuaternaryAlt};" + $"color:{theme.Palette.NeutralPrimary};" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@media screen and (-ms-high-contrast: active)" }, Properties = new CssString() { Css = ".ms-DetailsRow.is-selected:hover .ms-DetailsRow-cell {" + $"color:HighlightText;" + "}" + ".ms-DetailsRow.is-selected:hover .ms-DetailsRow-cell > a {" + $"color:HighlightText;" + "}" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-selected.is-row-header:hover" }, Properties = new CssString() { Css = $"color:{theme.Palette.NeutralDark};" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@media screen and (-ms-high-contrast: active)" }, Properties = new CssString() { Css = ".ms-DetailsRow.is-selected.is-row-header:hover {" + $"color:HighlightText;" + "}" + ".ms-DetailsRow.is-selected:hover {" + $"background:Highlight;" + "}" } }); // ##################################################################################### // selected NOT FINISHED! // ##################################################################################### // CellUnpadded detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-cellUnpadded" }, Properties = new CssString() { Css = $"padding-right:{CellRightPadding}px;" } }); // CellPadded detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-cellPadded" }, Properties = new CssString() { Css = $"padding-right:{CellExtraRightPadding + CellRightPadding}px;" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-cellPadded.ms-DetailsRow-cellCheck" }, Properties = new CssString() { Css = $"padding-right:0px;" } }); //Cell var rules = GetDefaultCellStyles(".ms-DetailsRow-cell", theme); foreach (var rule in rules) { detailsRowRules.Add(rule); } // CellMeasurer detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-cellMeasurer" }, Properties = new CssString() { Css = $"overflow:visible;" + $"white-space:nowrap;" } }); // CheckCell detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-checkCell" }, Properties = new CssString() { Css = $"padding:0px;" + $"padding-top:1px;" + $"margin-top:-1px;" + $"flex-shrink:0;" } }); // CheckCover detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-checkCover" }, Properties = new CssString() { Css = $"position:absolute;" + $"top:-1px;" + $"left:0px;" + $"bottom:0px;" + $"right:0px;" } }); //Fields detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-fields" }, Properties = new CssString() { Css = $"display:flex;" + $"align-items:stretch;" + $"overflow-x:hidden;" } }); //IsRowHeader detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-row-header" }, Properties = new CssString() { Css = $"color:{theme.Palette.NeutralPrimary};" + $"font-size:{theme.FontStyle.FontSize.Medium};" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-row-header.is-selected" }, Properties = new CssString() { Css = $"color:{theme.Palette.NeutralDark};" + $"font-weight:{theme.FontStyle.FontWeight.SemiBold};" } }); detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@media screen and (-ms-high-contrast: active)" }, Properties = new CssString() { Css = ".ms-DetailsRow.is-row-header.is-selected {" + $"color:HighlightText;" + "}" } }); // IsMultiline detailsRowRules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow.is-multiline" }, Properties = new CssString() { Css = $"white-space:normal;" + $"word-break:break-word;" + $"text-overflow:clip;" } }); //DetailsRowGlobalRules.Add(new Rule() //{ // Selector = new CssStringSelector() { SelectorName = ".ms-DetailsRow-cell[data-is-focusable='true']" }, // Properties = new CssString() // { // Css = "max-width:100%;" // } //}); var selectedfocusStyleProps = new FocusStyleProps(theme); selectedfocusStyleProps.Inset = -1; selectedfocusStyleProps.BorderColor = theme.SemanticColors.FocusBorder; selectedfocusStyleProps.OutlineColor = theme.Palette.White; var selectedMergeStyleResults = FocusStyle.GetFocusStyle(selectedfocusStyleProps, ".ms-List-cell.is-selected .ms-DetailsRow"); return(detailsRowRules); }
/// <summary> /// Gets the text effects or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual TextEffectCollection GetTextEffects(ITheme theme) => null;
private List <Rule> GetDefaultCellStyles(string selector, ITheme theme) { var rules = new List <Rule>(); // Cell var cellfocusStyleProps = new FocusStyleProps(theme); cellfocusStyleProps.Inset = -1; cellfocusStyleProps.BorderColor = theme.Palette.NeutralSecondary; cellfocusStyleProps.OutlineColor = theme.Palette.White; var cellMergeStyleResults = FocusStyle.GetFocusStyle(cellfocusStyleProps, $".ms-DetailsRow {selector}"); rules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = $".ms-DetailsRow {selector}" }, Properties = new CssString() { Css = cellMergeStyleResults.MergeRules + $"display:inline-block;" + $"position:relative;" + $"box-sizing:border-box;" + $"min-height:{RowHeight}px;" + $"vertical-align:top;" + $"white-space:nowrap;" + $"overflow:hidden;" + $"text-overflow:ellipsis;" + $"padding-top:{RowVerticalPadding}px;" + $"padding-bottom:{RowVerticalPadding}px;" + $"padding-left:{CellLeftPadding}px;" } }); rules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = $".ms-DetailsRow {selector} > button" }, Properties = new CssString() { Css = "max-width:100%;" } }); rules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = "@media screen and (-ms-high-contrast: active)" }, Properties = new CssString() { Css = $".ms-DetailsRow.is-selected {selector} {{" + $"background:Highlight;" + $"color:HighlightText;" + $"-ms-high-contrast-adjust:none;" + "}" + $".ms-DetailsRow.is-selected {selector} > a {{" + $"color:HighlightText;" + "}" } }); rules.Add(new Rule() { Selector = new CssStringSelector() { SelectorName = $".ms-DetailsRow.is-compact {selector}" }, Properties = new CssString() { Css = cellMergeStyleResults.MergeRules + $"min-height:{CompactRowHeight}px;" + $"padding-top:{CompactRowVerticalPadding}px;" + $"padding-bottom:{CompactRowVerticalPadding}px;" + $"padding-left:{CellLeftPadding}px;" } }); return(rules); }
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func <string, string> recurse) { var templateNameGroup = match.Groups["templateName"]; if (templateNameGroup == null) { return(""); } var templateName = templateNameGroup.Value; var template = _templateStorage.Load(templateName, theme); if (template == null) { return(""); } var settings = new Dictionary <string, object>(); var settingsGroup = match.Groups["settings"]; if (settingsGroup != null && !string.IsNullOrEmpty(settingsGroup.Value)) { var settingsJson = settingsGroup.Value; if (!string.IsNullOrEmpty(settingsJson)) { var parsedSettings = JsonConvert.DeserializeObject <IDictionary <string, object> >(settingsJson); foreach (var item in parsedSettings) { settings[item.Key] = item.Value; } } } var renderResult = cmsRenderer.RenderTemplate(template, settings, context, theme); return(renderResult.Read()); }
/// <summary> /// Gets the font hinting em size or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual double?GetFontHintingEmSize(ITheme theme) => null;
public static void SetTheme(this ResourceDictionary resourceDictionary, ITheme theme) { if (resourceDictionary == null) { throw new ArgumentNullException(nameof(resourceDictionary)); } SetSolidColorBrush(resourceDictionary, "PrimaryHueLightBrush", theme.PrimaryLight.Color); SetSolidColorBrush(resourceDictionary, "PrimaryHueLightForegroundBrush", theme.PrimaryLight.ForegroundColor ?? theme.PrimaryLight.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "PrimaryHueMidBrush", theme.PrimaryMid.Color); SetSolidColorBrush(resourceDictionary, "PrimaryHueMidForegroundBrush", theme.PrimaryMid.ForegroundColor ?? theme.PrimaryMid.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "PrimaryHueDarkBrush", theme.PrimaryDark.Color); SetSolidColorBrush(resourceDictionary, "PrimaryHueDarkForegroundBrush", theme.PrimaryDark.ForegroundColor ?? theme.PrimaryDark.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "SecondaryHueLightBrush", theme.SecondaryLight.Color); SetSolidColorBrush(resourceDictionary, "SecondaryHueLightForegroundBrush", theme.SecondaryLight.ForegroundColor ?? theme.SecondaryLight.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "SecondaryHueMidBrush", theme.SecondaryMid.Color); SetSolidColorBrush(resourceDictionary, "SecondaryHueMidForegroundBrush", theme.SecondaryMid.ForegroundColor ?? theme.SecondaryMid.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "SecondaryHueDarkBrush", theme.SecondaryDark.Color); SetSolidColorBrush(resourceDictionary, "SecondaryHueDarkForegroundBrush", theme.SecondaryDark.ForegroundColor ?? theme.SecondaryDark.Color.ContrastingForegroundColor()); //NB: These are here for backwards compatibility, and will be removed in a future version. SetSolidColorBrush(resourceDictionary, "SecondaryAccentBrush", theme.SecondaryMid.Color); SetSolidColorBrush(resourceDictionary, "SecondaryAccentForegroundBrush", theme.SecondaryMid.ForegroundColor ?? theme.SecondaryMid.Color.ContrastingForegroundColor()); SetSolidColorBrush(resourceDictionary, "ValidationErrorBrush", theme.ValidationError); resourceDictionary["ValidationErrorColor"] = theme.ValidationError; SetSolidColorBrush(resourceDictionary, "MaterialDesignBackground", theme.Background); SetSolidColorBrush(resourceDictionary, "MaterialDesignPaper", theme.Paper); SetSolidColorBrush(resourceDictionary, "MaterialDesignCardBackground", theme.CardBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignToolBarBackground", theme.ToolBarBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignBody", theme.Body); SetSolidColorBrush(resourceDictionary, "MaterialDesignBodyLight", theme.BodyLight); SetSolidColorBrush(resourceDictionary, "MaterialDesignColumnHeader", theme.ColumnHeader); SetSolidColorBrush(resourceDictionary, "MaterialDesignCheckBoxOff", theme.CheckBoxOff); SetSolidColorBrush(resourceDictionary, "MaterialDesignCheckBoxDisabled", theme.CheckBoxDisabled); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextBoxBorder", theme.TextBoxBorder); SetSolidColorBrush(resourceDictionary, "MaterialDesignDivider", theme.Divider); SetSolidColorBrush(resourceDictionary, "MaterialDesignSelection", theme.Selection); SetSolidColorBrush(resourceDictionary, "MaterialDesignFlatButtonClick", theme.FlatButtonClick); SetSolidColorBrush(resourceDictionary, "MaterialDesignFlatButtonRipple", theme.FlatButtonRipple); SetSolidColorBrush(resourceDictionary, "MaterialDesignToolTipBackground", theme.ToolTipBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignChipBackground", theme.ChipBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignSnackbarBackground", theme.SnackbarBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignSnackbarMouseOver", theme.SnackbarMouseOver); SetSolidColorBrush(resourceDictionary, "MaterialDesignSnackbarRipple", theme.SnackbarRipple); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextFieldBoxBackground", theme.TextFieldBoxBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextFieldBoxHoverBackground", theme.TextFieldBoxHoverBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextFieldBoxDisabledBackground", theme.TextFieldBoxDisabledBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextAreaBorder", theme.TextAreaBorder); SetSolidColorBrush(resourceDictionary, "MaterialDesignTextAreaInactiveBorder", theme.TextAreaInactiveBorder); if (!(resourceDictionary.GetThemeManager() is ThemeManager themeManager)) { resourceDictionary[ThemeManagerKey] = themeManager = new ThemeManager(resourceDictionary); } ITheme oldTheme = resourceDictionary.GetTheme(); resourceDictionary[CurrentThemeKey] = theme; themeManager.OnThemeChange(oldTheme, theme); }
/// <summary> /// Gets the <see cref="CultureInfo"/> or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual CultureInfo GetCultureInfo(ITheme theme) => null;
public void Render(TemplateRenderInformation information, ICmsContext context, ITheme theme, TextWriter renderTo) { var renderResult = _cmsRenderer.RenderTemplate(information.Template, information.OverrideSettings, context, theme); renderResult.RenderTo(renderTo); }
/// <summary> /// Gets the background brush or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual Brush GetBackground(ITheme theme) => null;
/// <summary> /// Method to render this layer to the map, applying <paramref name="theme"/>. /// </summary> /// <param name="g">The graphics object</param> /// <param name="map">The map object</param> /// <param name="envelope">The envelope to render</param> /// <param name="theme">The theme to apply</param> protected void RenderInternal(Graphics g, MapViewport map, Envelope envelope, ITheme theme) { var ds = new FeatureDataSet(); lock (_dataSource) { DataSource.Open(); DataSource.ExecuteIntersectionQuery(envelope, ds); DataSource.Close(); } double scale = map.GetMapScale((int)g.DpiX); double zoom = map.Zoom; foreach (FeatureDataTable features in ds.Tables) { // Transform geometries if necessary if (CoordinateTransformation != null) { for (int i = 0; i < features.Count; i++) { features[i].Geometry = ToTarget(features[i].Geometry); } } //Linestring outlines is drawn by drawing the layer once with a thicker line //before drawing the "inline" on top. if (Style.EnableOutline) { for (int i = 0; i < features.Count; i++) { var feature = features[i]; var outlineStyle = theme.GetStyle(feature) as VectorStyle; if (outlineStyle == null) { continue; } if (!(outlineStyle.Enabled && outlineStyle.EnableOutline)) { continue; } double compare = outlineStyle.VisibilityUnits == VisibilityUnits.ZoomLevel ? zoom : scale; if (!(outlineStyle.MinVisible <= compare && compare <= outlineStyle.MaxVisible)) { continue; } using (outlineStyle = outlineStyle.Clone()) { if (outlineStyle != null) { //Draw background of all line-outlines first if (feature.Geometry is ILineString) { VectorRenderer.DrawLineString(g, feature.Geometry as ILineString, outlineStyle.Outline, map, outlineStyle.LineOffset); } else if (feature.Geometry is IMultiLineString) { VectorRenderer.DrawMultiLineString(g, feature.Geometry as IMultiLineString, outlineStyle.Outline, map, outlineStyle.LineOffset); } } } } } for (int i = 0; i < features.Count; i++) { var feature = features[i]; var style = theme.GetStyle(feature); if (style == null) { continue; } if (!style.Enabled) { continue; } double compare = style.VisibilityUnits == VisibilityUnits.ZoomLevel ? zoom : scale; if (!(style.MinVisible <= compare && compare <= style.MaxVisible)) { continue; } IEnumerable <IStyle> stylesToRender = GetStylesToRender(style); if (stylesToRender == null) { return; } foreach (var vstyle in stylesToRender) { if (!(vstyle is VectorStyle) || !vstyle.Enabled) { continue; } using (var clone = (vstyle as VectorStyle).Clone()) { if (clone != null) { RenderGeometry(g, map, feature.Geometry, clone); } } } } } }
/// <summary> /// Draw a branch with no segments; this will usually be drawn with the style for the default value. /// </summary> /// <param name="map"></param> /// <param name="coverage"></param> /// <param name="g"></param> /// <param name="style"></param> /// <param name="mapExtents"></param> /// <param name="drawnBranches"></param> /// <param name="theme"></param> private static void RenderSegmentFreeBranches(Map map, INetworkCoverage coverage, Graphics g, VectorStyle style, IEnvelope mapExtents, HashSet <IBranch> drawnBranches, ITheme theme) { var visibleBranches = coverage.Network.Branches.Where(b => b.Geometry.EnvelopeInternal.Intersects(mapExtents)).ToList(); visibleBranches.ForEach(vb => { if (!drawnBranches.Contains(vb)) { VectorRenderingHelper.RenderGeometry(g, map, vb.Geometry, style, null, true); } }); }
/// <summary> /// Gets the text decorations or null /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public virtual TextDecorationCollection GetTextDecorations(ITheme theme) => null;
public virtual void bindThemes(IBlock block, String lbl, Object x) { ITheme theme = x as ITheme; block.Set("x.data.delete", to(Delete, ctx.route.id) + "?id=" + theme.Id); }
protected void RenderInternal(Graphics g, Map map, BoundingBox envelope, ITheme theme) { FeatureDataSet ds = new FeatureDataSet(); lock (_dataSource) { DataSource.Open(); DataSource.ExecuteIntersectionQuery(envelope, ds); DataSource.Close(); } foreach (FeatureDataTable features in ds.Tables) { if (CoordinateTransformation != null) { for (int i = 0; i < features.Count; i++) #if !DotSpatialProjections { features[i].Geometry = GeometryTransform.TransformGeometry(features[i].Geometry, CoordinateTransformation. MathTransform); } } #else { features[i].Geometry = GeometryTransform.TransformGeometry(features[i].Geometry, CoordinateTransformation.Source, CoordinateTransformation.Target); } #endif //Linestring outlines is drawn by drawing the layer once with a thicker line //before drawing the "inline" on top. if (Style.EnableOutline) { //foreach (SharpMap.Geometries.Geometry feature in features) for (int i = 0; i < features.Count; i++) { FeatureDataRow feature = features[i]; VectorStyle outlineStyle = Theme.GetStyle(feature) as VectorStyle; if (outlineStyle == null) { continue; } if (!(outlineStyle.Enabled && outlineStyle.EnableOutline)) { continue; } if (!(outlineStyle.MinVisible <= map.Zoom && map.Zoom <= outlineStyle.MaxVisible)) { continue; } //Draw background of all line-outlines first if (feature.Geometry is LineString) { VectorRenderer.DrawLineString(g, feature.Geometry as LineString, outlineStyle.Outline, map, outlineStyle.LineOffset); } else if (feature.Geometry is MultiLineString) { VectorRenderer.DrawMultiLineString(g, feature.Geometry as MultiLineString, outlineStyle.Outline, map, outlineStyle.LineOffset); } } } for (int i = 0; i < features.Count; i++) { FeatureDataRow feature = features[i]; VectorStyle style = Theme.GetStyle(feature) as VectorStyle; if (style == null) { continue; } if (!style.Enabled) { continue; } if (!(style.MinVisible <= map.Zoom && map.Zoom <= style.MaxVisible)) { continue; } RenderGeometry(g, map, feature.Geometry, style); } } }
public void GenerateThemeForQuantityBilFileWithLegendFile() { const string fileName = @"..\..\..\..\..\test-data\DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\RasterData\FloatValues.bil"; RegularGridCoverageLayer rasterLayer = new RegularGridCoverageLayer(); GdalFeatureProvider rasterFeatureProvider = new GdalFeatureProvider { Path = fileName }; rasterLayer.DataSource = rasterFeatureProvider; IRegularGridCoverage grid = rasterLayer.Grid; ITheme theme = DemisMapControlLegendHelper.ConvertLegendToTheme(fileName, "value", grid); ICollection colors = new List <string>(new string[] { "000000", "E1E1FE", "DCD9FE", "D6D0FE", "D0C8FF", "CBC0FF", "C09EFF", "B57BFF", "A959FF", "9E36FF", "9314FF" }); ICollection values = new List <double>(new double[] { -16.9996604919434, -13.5799999237061, -10.1499996185303, -6.73000001907349, -3.29999995231628, .119999997317791, 3.54999995231628, 6.96999979019165, 10.3900003433228, 13.8199996948242, 17.2399997711182 }); Assert.IsInstanceOfType(typeof(QuantityTheme), theme); foreach (IThemeItem themeItem in theme.ThemeItems) { Assert.IsInstanceOfType(typeof(QuantityThemeItem), themeItem); Assert.IsInstanceOfType(typeof(VectorStyle), themeItem.Style); double value = ((QuantityThemeItem)themeItem).Interval.Max; Assert.Contains(value, values); ((List <double>)values).Remove(value); string color = FromColorToBGRString(((SolidBrush)((VectorStyle)themeItem.Style).Fill).Color); Assert.Contains(color, colors); ((List <string>)colors).Remove(color); } Assert.IsTrue(colors.Count == 0); Assert.IsTrue(values.Count == 0); }
/// <summary> /// Creates a new <see cref="ResourceDictionary"/> /// </summary> /// <param name="theme">Theme</param> /// <returns></returns> public ResourceDictionary CreateResourceDictionary(ITheme theme) { var res = new ResourceDictionary(); var bg = GetWindowBackground(theme) ?? SystemColors.WindowBrush; res[EditorFormatMapConstants.TextViewBackgroundId] = bg; var typeface = GetTypeface(theme); var foreground = GetForeground(theme); var background = GetBackground(theme); var cultureInfo = GetCultureInfo(theme); var hintingSize = GetFontHintingEmSize(theme); var renderingSize = GetFontRenderingEmSize(theme); var textDecorations = GetTextDecorations(theme); var textEffects = GetTextEffects(theme); var isBold = GetIsBold(theme); var isItalic = GetIsItalic(theme); var fgOpacity = GetForegroundOpacity(theme); var bgOpacity = GetBackgroundOpacity(theme); if (typeface != null) { res[ClassificationFormatDefinition.TypefaceId] = typeface; } if (foreground != null) { res[EditorFormatDefinition.ForegroundBrushId] = foreground; } if (background != null) { res[EditorFormatDefinition.BackgroundBrushId] = background; } if (cultureInfo != null) { res[ClassificationFormatDefinition.CultureInfoId] = cultureInfo; } if (hintingSize != null) { res[ClassificationFormatDefinition.FontHintingSizeId] = hintingSize; } if (renderingSize != null) { res[ClassificationFormatDefinition.FontRenderingSizeId] = renderingSize; } if (textDecorations != null) { res[ClassificationFormatDefinition.TextDecorationsId] = textDecorations; } if (textEffects != null) { res[ClassificationFormatDefinition.TextEffectsId] = textEffects; } if (isBold != null) { res[ClassificationFormatDefinition.IsBoldId] = isBold; } if (isItalic != null) { res[ClassificationFormatDefinition.IsItalicId] = isItalic; } if (fgOpacity != null) { res[ClassificationFormatDefinition.ForegroundOpacityId] = fgOpacity; } if (bgOpacity != null) { res[ClassificationFormatDefinition.BackgroundOpacityId] = bgOpacity; } return(res); }
public override void ThemeChanged(ITheme visualTheme) { }
public KeeTheme() { _defaultTheme = new DefaultTheme(); _customTheme = new CustomTheme(IniFile.GetFromFile() ?? IniFile.GetFromResources()); _theme = _defaultTheme; }
/// <summary> /// Builds an <see cref="ADrawable" /> for this component. /// </summary> /// <param name="theme"> /// The theme. /// </param> /// <returns> /// The <see cref="ADrawable" /> instance. /// </returns> protected override ADrawable BuildHandler(ITheme theme) { return theme.BuildKeyBindHandler(this); }
/// <summary> /// Builds an <see cref="ADrawable" /> for this component. /// </summary> /// <param name="theme"> /// The theme. /// </param> /// <returns> /// The <see cref="ADrawable" /> instance. /// </returns> protected override ADrawable BuildHandler(ITheme theme) { return(theme.BuildListHandler(this)); }