public SettingsWindowViewmodel(MainWindow main, AppSettings data) { mainWindow = main; Settings = data; ShortcutList = ShortcutManager.ListObservableShortcuts(data); AvailableThemes = App.Themes.GetAllAvailableThemes(); AvailableModifier = App.Themes.GetAllAvailableModifier().Select(m => new CheckableAlephTheme { Theme = m, Owner = this, Checked = data.ThemeModifier.Contains(m.SourceFilename) }).ToList(); _selectedTheme = App.Themes.GetThemeByFilename(Settings.Theme, out _) ?? App.Themes.GetDefault() ?? AvailableThemes.FirstOrDefault() ?? App.Themes.GetFallback(); _oldTheme = ThemeManager.Inst.CurrentBaseTheme; _oldModifiers = ThemeManager.Inst.CurrentModifers.ToList(); SnippetList = new ObservableCollectionNoReset <EditableSnippet>(data.Snippets.Data.Select(p => new EditableSnippet { PreviewFunc = SnippetPrev, ID = p.Key, Name = p.Value.DisplayName, Value = p.Value.Value })); NewSnippetID = GetNextSnippetID(); }
private static void CreateBrushes(AlephTheme t) { StandardBrush = BrushRefToBrush.Convert(t.Get <BrushRef>("window.tageditor.tag:bordercolor_default")); HighlightBrush = new DrawingBrush { Viewport = new System.Windows.Rect(0, 0, 8, 8), ViewportUnits = BrushMappingMode.Absolute, TileMode = TileMode.Tile, Drawing = new GeometryDrawing { Brush = BrushRefToBrush.Convert(t.Get <BrushRef>("window.tageditor.tag:bordercolor_highlighted")), Geometry = new GeometryGroup { Children = new GeometryCollection(new Geometry[] { new RectangleGeometry { Rect = new System.Windows.Rect(0, 0, 50, 50) }, new RectangleGeometry { Rect = new System.Windows.Rect(50, 50, 50, 50) }, }) } } }; StandardBrush.Freeze(); HighlightBrush.Freeze(); _currTheme = t; }
public void ChangeTheme(AlephTheme t) { CurrentTheme = t; _listener.RemoveAll(l => !l.IsTargetAlive); foreach (var s in _listener.Where(l => l.IsTargetAlive)) { s.OnThemeChanged(); } }
public void ChangeTheme(AlephTheme t, IEnumerable <AlephTheme> m) { CurrentBaseTheme = t; CurrentModifers = m.ToList(); CurrentThemeSet = new AlephThemeSet(Cache.GetDefaultOrFallback(), CurrentBaseTheme, CurrentModifers); _listener.RemoveAll(l => !l.IsTargetAlive); foreach (var s in _listener.Where(l => l.IsTargetAlive)) { s.OnThemeChanged(); } }
public SettingsWindowViewmodel(MainWindow main, AppSettings data) { mainWindow = main; Settings = data; ShortcutList = ShortcutManager.ListObservableShortcuts(data); AvailableThemes = App.Themes.GetAllAvailable(); _selectedTheme = App.Themes.GetByFilename(Settings.Theme, out _) ?? App.Themes.GetByFilename("default.xml", out _) ?? AvailableThemes.FirstOrDefault() ?? App.Themes.GetFallback(); }
private void UpdateThemePreview() { if (SelectedTheme == null || SelectedTheme.IsFallback) { return; } _isThemePreview = true; if (_oldTheme == null) { _oldTheme = ThemeManager.Inst.CurrentTheme; } ThemeManager.Inst.ChangeTheme(SelectedTheme); }
private void UpdateThemePreview() { if (SelectedTheme == null || SelectedTheme.ThemeType == AlephThemeType.Fallback) { return; } _isThemePreview = true; if (_oldTheme == null) { _oldTheme = ThemeManager.Inst.CurrentBaseTheme; } if (_oldModifiers == null) { _oldModifiers = ThemeManager.Inst.CurrentModifers.ToList(); } ThemeManager.Inst.ChangeTheme(SelectedTheme, GetCheckedModifier()); }
public static System.Drawing.Bitmap GetDBitmapResource(this AlephThemeSet set, string name) { return(set.GetResource(name, BitmapFromByteArray, () => BitmapFromResource(AlephTheme.GetDefaultResourceUri(name)))); }
public static System.Drawing.Icon GetIconResource(this AlephThemeSet set, string name) { return(set.GetResource(name, IconFromByteArray, () => IconFromResource(AlephTheme.GetDefaultResourceUri(name)))); }
public static BitmapImage GetBitmapImageResource(this AlephThemeSet set, string name) { return(set.GetResource(name, BitmapImageFromByteArray, () => new BitmapImage(AlephTheme.GetDefaultResourceUri(name)))); }
private ThemeManager(ThemeCache c) { Cache = c; CurrentTheme = c.GetFallback(); }