mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-01 17:24:59 +00:00
refactor<*>: use DynamicResource instead of StaticResource for brushes and locales
This commit is contained in:
parent
4a56b47265
commit
afc4eafb6f
73 changed files with 630 additions and 601 deletions
|
@ -26,9 +26,10 @@ namespace SourceGit.Views.Controls {
|
|||
Height = 18;
|
||||
CornerRadius = new CornerRadius(9);
|
||||
VerticalAlignment = VerticalAlignment.Center;
|
||||
Background = FindResource("Brush.Badge") as Brush;
|
||||
Visibility = Visibility.Collapsed;
|
||||
|
||||
SetResourceReference(BackgroundProperty, "Brush.Badge");
|
||||
|
||||
label = new TextBlock();
|
||||
label.FontSize = 10;
|
||||
label.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
|
|
|
@ -69,14 +69,14 @@ namespace SourceGit.Views.Controls {
|
|||
|
||||
if (!mark.IsNewPage) {
|
||||
if (mark.Color == 0) {
|
||||
mark.icon.Fill = mark.FindResource("Brush.FG1") as Brush;
|
||||
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
|
||||
mark.icon.Data = mark.FindResource("Icon.Git") as Geometry;
|
||||
} else {
|
||||
mark.icon.Fill = COLORS[mark.Color % COLORS.Length];
|
||||
mark.icon.Data = mark.FindResource("Icon.Bookmark") as Geometry;
|
||||
}
|
||||
} else {
|
||||
mark.icon.Fill = mark.FindResource("Brush.FG1") as Brush;
|
||||
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
|
||||
mark.icon.Data = mark.FindResource("Icon.WelcomePage") as Geometry;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace SourceGit.Views.Controls {
|
|||
|
||||
public ChangeDisplaySwitcher() {
|
||||
icon = new Path();
|
||||
icon.Fill = FindResource("Brush.FG2") as Brush;
|
||||
icon.Data = FindResource("Icon.Tree") as Geometry;
|
||||
icon.SetResourceReference(Path.FillProperty, "Brush.FG2");
|
||||
|
||||
Content = icon;
|
||||
Style = FindResource("Style.Button") as Style;
|
||||
|
@ -73,8 +73,8 @@ namespace SourceGit.Views.Controls {
|
|||
var iconMode = new Path();
|
||||
iconMode.Width = 12;
|
||||
iconMode.Height = 12;
|
||||
iconMode.Fill = FindResource("Brush.FG2") as Brush;
|
||||
iconMode.Data = FindResource(icon) as Geometry;
|
||||
iconMode.SetResourceReference(Path.FillProperty, "Brush.FG2");
|
||||
|
||||
var item = new MenuItem();
|
||||
item.Icon = iconMode;
|
||||
|
|
|
@ -109,6 +109,7 @@ namespace SourceGit.Views.Controls {
|
|||
private double startY = 0;
|
||||
|
||||
public CommitGraph() {
|
||||
Models.Theme.AddListener(this, InvalidateVisual);
|
||||
IsHitTestVisible = false;
|
||||
ClipToBounds = true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shell;
|
||||
|
||||
namespace SourceGit.Views.Controls {
|
||||
/// <summary>
|
||||
|
@ -20,32 +18,16 @@ namespace SourceGit.Views.Controls {
|
|||
}
|
||||
|
||||
public Window() {
|
||||
Background = FindResource("Brush.Window") as Brush;
|
||||
BorderBrush = FindResource("Brush.WindowBorder") as Brush;
|
||||
BorderThickness = new Thickness(1);
|
||||
|
||||
SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
|
||||
SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.ClearType);
|
||||
SetValue(TextOptions.TextHintingModeProperty, TextHintingMode.Animated);
|
||||
UseLayoutRounding = true;
|
||||
|
||||
var chrome = new WindowChrome();
|
||||
chrome.ResizeBorderThickness = new Thickness(4);
|
||||
chrome.UseAeroCaptionButtons = false;
|
||||
chrome.CornerRadius = new CornerRadius(0);
|
||||
chrome.CaptionHeight = 28;
|
||||
WindowChrome.SetWindowChrome(this, chrome);
|
||||
Style = FindResource("Style.Window") as Style;
|
||||
|
||||
StateChanged += (_, __) => {
|
||||
var content = Content as FrameworkElement;
|
||||
|
||||
if (WindowState == WindowState.Maximized) {
|
||||
if (!IsMaximized) IsMaximized = true;
|
||||
BorderThickness = new Thickness(0);
|
||||
content.Margin = new Thickness((SystemParameters.MaximizedPrimaryScreenWidth - SystemParameters.WorkArea.Width) / 2);
|
||||
} else {
|
||||
if (IsMaximized) IsMaximized = false;
|
||||
BorderThickness = new Thickness(1);
|
||||
content.Margin = new Thickness(0);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue