public Color GetThemeColor(eThemeMode themeMode) { Color color; _colors.TryGetValue(themeMode, out color); return(color); }
public virtual StyleBase GetStyle(eThemeMode mode) { StyleBase style; _styles.TryGetValue(mode, out style); return(style); }
public virtual ElementConfiguration GetStyle(eThemeMode mode) { ElementConfiguration style; _styles.TryGetValue(mode, out style); return(style); }
public string this[eThemeMode key] { get { string mode; _theme_key_mode.TryGetValue(key, out mode); return(mode); } }
public static Color GetBackColorByThemeMode(eThemeMode mode) { switch (mode) { case eThemeMode.Dark: return(DarkBackColor); case eThemeMode.Light: return(LightBackColor); default: return(DarkBackColor); } }
public virtual void AddStyle(eThemeMode mode, StyleBase style) { _styles[mode] = style; }
public static void RenderBoxText(IRenderContext rc, eThemeMode themeMode, OxyRect clippingRect, string text, int textPadding, ScreenPoint sp, ScreenPoint offset, OxyColor color, BoxPosition position = BoxPosition.Left, string font = "Arial") { OxySize text_size = rc.MeasureText(text, font); ScreenPoint down_line_sp = new ScreenPoint(sp.X + offset.X, sp.Y + offset.Y); ScreenPoint text_sp = new ScreenPoint(sp.X + offset.X + TextPadding, sp.Y - text_size.Height - TextPadding + offset.Y); IList <ScreenPoint> line = new List <ScreenPoint>(); line.Add(sp); double box_width = text_size.Width + 2 * TextPadding; double box_height = text_size.Height + 2 * TextPadding; OxyRect rect; switch (position) { case BoxPosition.Left: rect = new OxyRect(down_line_sp.X, down_line_sp.Y - box_height, box_width, box_height); break; case BoxPosition.Middle: down_line_sp = new ScreenPoint(down_line_sp.X - offset.X, down_line_sp.Y); rect = new OxyRect(down_line_sp.X - box_width / 2, down_line_sp.Y - box_height, box_width, box_height); text_sp = new ScreenPoint(down_line_sp.X - text_size.Width / 2, text_sp.Y); break; case BoxPosition.Right: rect = new OxyRect(down_line_sp.X - box_width, down_line_sp.Y - box_height, box_width, box_height); text_sp = new ScreenPoint(down_line_sp.X - text_size.Width, text_sp.Y); break; default: rect = new OxyRect(0, 0, 0, 0); break; } //ajust if (!Pan.ContainsRect(clippingRect, rect)) { ScreenVector vector = Pan.AjustBound(rect, clippingRect); rect = Pan.PanRect(rect, vector); down_line_sp = Pan.PanPoint(down_line_sp, vector); text_sp = Pan.PanPoint(text_sp, vector); } line.Add(down_line_sp); rc.DrawLine(line, color); if (rect.Width > 0 && rect.Height > 0) { OxyColor back_color = Convertor.ConvertColorToOxyColor(Helper.DarkBackColor); OxyColor fore_color = Convertor.ConvertColorToOxyColor(Helper.LightBackColor); switch (themeMode) { case eThemeMode.Dark: back_color = Convertor.ConvertColorToOxyColor(Helper.DarkBackColor); fore_color = OxyColors.White; break; case eThemeMode.Light: back_color = Convertor.ConvertColorToOxyColor(Helper.LightBackColor); fore_color = OxyColors.Black; break; } rc.DrawRectangle(rect, back_color, fore_color); rc.DrawText(text_sp, text, fore_color, font); } }
public void SetThemeColor(eThemeMode themeMode, Color color) { _colors[themeMode] = color; }
public virtual void AddStyle(eThemeMode mode, ElementConfiguration style) { _styles[mode] = style; }