refactor<*>: add Controls.Window to replace System.Windows.Window

This commit is contained in:
leo 2021-06-18 09:26:19 +08:00
parent 31dd0eb832
commit 4b9923b84c
15 changed files with 842 additions and 879 deletions

View file

@ -4,7 +4,7 @@
<SolidColorBrush x:Key="Brush.Logo" Color="#FFF05133"/>
<SolidColorBrush x:Key="Brush.Window" Color="#FFF8F8F8"/>
<SolidColorBrush x:Key="Brush.WindowBorder" Color="#FF505050"/>
<SolidColorBrush x:Key="Brush.WindowBorder" Color="#FF4295FF"/>
<SolidColorBrush x:Key="Brush.TitleBar" Color="White"/>
<SolidColorBrush x:Key="Brush.NewPageHover" Color="#1D000000"/>

View file

@ -1,97 +1,91 @@
<Window x:Class="SourceGit.Views.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
UseLayoutRounding="True"
WindowStartupLocation="CenterOwner"
Title="{StaticResource Text.About}"
Height="280" Width="400"
ResizeMode="NoResize">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
Title="{StaticResource Text.About}"
Height="280" Width="400"
ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Title bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Help}"/>
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Help}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.About}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.About}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28"
Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28"
Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Content -->
<StackPanel Grid.Row="2" Orientation="Vertical">
<!-- Content -->
<StackPanel Grid.Row="2" Orientation="Vertical">
<!-- LOGO -->
<Path
Margin="0,16,0,0"
Width="64" Height="64"
Data="{StaticResource Icon.Git}"
Fill="{StaticResource Brush.Logo}"/>
<!-- LOGO -->
<Path
Margin="0,16,0,0"
Width="64" Height="64"
Data="{StaticResource Icon.Git}"
Fill="{StaticResource Brush.Logo}"/>
<!-- Title -->
<TextBlock
Margin="0,24,0,8"
Text="{StaticResource Text.About.Title}"
HorizontalAlignment="Center"
FontSize="18" FontWeight="Bold"/>
<!-- Title -->
<TextBlock
Margin="0,24,0,8"
Text="{StaticResource Text.About.Title}"
HorizontalAlignment="Center"
FontSize="18" FontWeight="Bold"/>
<!-- Version -->
<TextBlock
x:Name="version"
Margin="0,0,0,8"
HorizontalAlignment="Center"
FontSize="11"
Text="VERSION: v1.0 .NET: v5.0"/>
<!-- Version -->
<TextBlock
x:Name="version"
Margin="0,0,0,8"
HorizontalAlignment="Center"
FontSize="11"
Text="VERSION: v1.0 .NET: v5.0"/>
<!-- Official site -->
<TextBlock HorizontalAlignment="Center" Margin="0,16,0,4">
<!-- Official site -->
<TextBlock HorizontalAlignment="Center" Margin="0,16,0,4">
<Hyperlink NavigateUri="https://gitee.com/sourcegit/sourcegit.git" RequestNavigate="OnRequestNavigate">
<Run Text="https://gitee.com/sourcegit/sourcegit.git"/>
</Hyperlink>
</TextBlock>
</TextBlock>
<!-- Copyrights -->
<TextBlock
Margin="0,4"
Text="Copyright © sourcegit 2021. All rights reserved."
HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</controls:WindowBorder>
</Window>
<!-- Copyrights -->
<TextBlock
Margin="0,4"
Text="Copyright © sourcegit 2021. All rights reserved."
HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</controls:Window>

View file

@ -8,7 +8,7 @@ namespace SourceGit.Views {
/// <summary>
/// 关于对话框
/// </summary>
public partial class About : Window {
public partial class About : Controls.Window {
public About() {
InitializeComponent();

View file

@ -1,148 +1,139 @@
<Window x:Class="SourceGit.Views.Blame"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
Title="{StaticResource Text.Blame}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
RenderOptions.ClearTypeHint="Enabled"
UseLayoutRounding="True"
WindowStartupLocation="CenterOwner"
Height="600" Width="800">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.Blame"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
Title="{StaticResource Text.Blame}"
WindowStartupLocation="CenterOwner"
Height="600" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Commit}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.Blame}"/>
<!-- Window Commands -->
<StackPanel Grid.Column="3" Orientation="Horizontal" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<!-- Line -->
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Description -->
<Border Grid.Row="2">
<Grid Margin="4,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Commit}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.Blame}"/>
<!-- Window Commands -->
<StackPanel Grid.Column="3" Orientation="Horizontal" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
<TextBlock Grid.Column="0" x:Name="txtFile" FontSize="11" Foreground="{StaticResource Brush.FG2}" FontFamily="Consolas"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{StaticResource Brush.FG2}" FontFamily="11" Text="{StaticResource Text.Blame.Tip}"/>
</Grid>
</Border>
<!-- Line -->
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Viewer -->
<DataGrid
Grid.Row="3"
x:Name="blame"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="{StaticResource Brush.Border2}"
BorderBrush="{StaticResource Brush.Border2}"
BorderThickness="1"
FrozenColumnCount="1"
RowHeight="16"
SelectionUnit="FullRow"
SelectionMode="Single"
FontFamily="Consolas"
SizeChanged="OnViewerSizeChanged">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="RequestBringIntoView" Handler="OnViewerRequestBringIntoView"/>
<EventSetter Event="ContextMenuOpening" Handler="OnViewerContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Width="Auto" IsReadOnly="True" Binding="{Binding Line.LineNumber}" ElementStyle="{StaticResource Style.TextBlock.LineNumber}"/>
<DataGridTemplateColumn Width="SizeToCells" MinWidth="1" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Background="{Binding BG}" BorderThickness="0">
<TextBlock Text="{Binding Line.Content}" Background="Transparent" Foreground="{StaticResource Brush.FG1}" FontFamily="Consolas,Microsoft YaHei UI" FontSize="9pt" Margin="0" Padding="2,0,0,0"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel
x:Name="notSupport"
Grid.Row="3"
Orientation="Vertical"
VerticalAlignment="Center" HorizontalAlignment="Center"
Background="{StaticResource Brush.Window}"
Visibility="Collapsed">
<Path Width="64" Height="64" Data="{StaticResource Icon.Error}" Fill="{StaticResource Brush.FG2}"/>
<TextBlock Text="{StaticResource Text.BlameTypeNotSupported}" Margin="0,16,0,0" FontFamily="Consolas" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
</StackPanel>
<!-- Loading -->
<controls:Loading x:Name="loading" Grid.Row="3" Width="48" Height="48" IsAnimating="True"/>
<!-- Popup to show commit info -->
<Popup x:Name="popup" Grid.Row="3" Placement="MousePoint" IsOpen="False" StaysOpen="False" Focusable="True">
<Border BorderBrush="{StaticResource Brush.Accent1}" BorderThickness="1" Background="{StaticResource Brush.Popup}">
<Grid Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="24"/>
<RowDefinition Height="24"/>
</Grid.RowDefinitions>
<!-- Description -->
<Border Grid.Row="2">
<Grid Margin="4,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txtFile" FontSize="11" Foreground="{StaticResource Brush.FG2}" FontFamily="Consolas"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{StaticResource Brush.FG2}" FontFamily="11" Text="{StaticResource Text.Blame.Tip}"/>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{StaticResource Text.Blame.SHA}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<Label Grid.Row="0" Grid.Column="1" x:Name="commitID" Margin="8,0,4,0" Padding="0" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{StaticResource Text.Blame.Author}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="authorName" Margin="8,0,4,0"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{StaticResource Text.Blame.ModifyTime}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="authorTime" Margin="8,0,4,0"/>
</Grid>
</Border>
<!-- Viewer -->
<DataGrid
Grid.Row="3"
x:Name="blame"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="{StaticResource Brush.Border2}"
BorderBrush="{StaticResource Brush.Border2}"
BorderThickness="1"
FrozenColumnCount="1"
RowHeight="16"
SelectionUnit="FullRow"
SelectionMode="Single"
FontFamily="Consolas"
SizeChanged="OnViewerSizeChanged">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="RequestBringIntoView" Handler="OnViewerRequestBringIntoView"/>
<EventSetter Event="ContextMenuOpening" Handler="OnViewerContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Width="Auto" IsReadOnly="True" Binding="{Binding Line.LineNumber}" ElementStyle="{StaticResource Style.TextBlock.LineNumber}"/>
<DataGridTemplateColumn Width="SizeToCells" MinWidth="1" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Background="{Binding BG}" BorderThickness="0">
<TextBlock Text="{Binding Line.Content}" Background="Transparent" Foreground="{StaticResource Brush.FG1}" FontFamily="Consolas,Microsoft YaHei UI" FontSize="9pt" Margin="0" Padding="2,0,0,0"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel
x:Name="notSupport"
Grid.Row="3"
Orientation="Vertical"
VerticalAlignment="Center" HorizontalAlignment="Center"
Background="{StaticResource Brush.Window}"
Visibility="Collapsed">
<Path Width="64" Height="64" Data="{StaticResource Icon.Error}" Fill="{StaticResource Brush.FG2}"/>
<TextBlock Text="{StaticResource Text.BlameTypeNotSupported}" Margin="0,16,0,0" FontFamily="Consolas" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
</StackPanel>
<!-- Loading -->
<controls:Loading x:Name="loading" Grid.Row="3" Width="48" Height="48" IsAnimating="True"/>
<!-- Popup to show commit info -->
<Popup x:Name="popup" Grid.Row="3" Placement="MousePoint" IsOpen="False" StaysOpen="False" Focusable="True">
<Border BorderBrush="{StaticResource Brush.Accent1}" BorderThickness="1" Background="{StaticResource Brush.Popup}">
<Grid Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="24"/>
<RowDefinition Height="24"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{StaticResource Text.Blame.SHA}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<Label Grid.Row="0" Grid.Column="1" x:Name="commitID" Margin="8,0,4,0" Padding="0" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{StaticResource Text.Blame.Author}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="authorName" Margin="8,0,4,0"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{StaticResource Text.Blame.ModifyTime}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="authorTime" Margin="8,0,4,0"/>
</Grid>
</Border>
</Popup>
</Grid>
</controls:WindowBorder>
</Window>
</Popup>
</Grid>
</controls:Window>

View file

@ -11,7 +11,7 @@ namespace SourceGit.Views {
/// <summary>
/// 逐行追溯
/// </summary>
public partial class Blame : Window {
public partial class Blame : Controls.Window {
private static readonly Brush[] BG = new Brush[] {
Brushes.Transparent,
new SolidColorBrush(Color.FromArgb(128, 0, 0, 0))

View file

@ -0,0 +1,41 @@
using System.Windows;
using System.Windows.Media;
using System.Windows.Shell;
namespace SourceGit.Views.Controls {
/// <summary>
/// 项目使用的窗体基类
/// </summary>
public class Window : System.Windows.Window {
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);
StateChanged += (_, __) => {
var content = Content as FrameworkElement;
if (WindowState == WindowState.Maximized) {
BorderThickness = new Thickness(0);
content.Margin = new Thickness((SystemParameters.MaximizedPrimaryScreenWidth - SystemParameters.WorkArea.Width) / 2);
} else {
BorderThickness = new Thickness(1);
content.Margin = new Thickness(0);
}
};
}
}
}

View file

@ -1,36 +0,0 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace SourceGit.Views.Controls {
/// <summary>
/// 主窗体Border
/// </summary>
public class WindowBorder : Border {
public WindowBorder() {
Background = FindResource("Brush.Window") as Brush;
BorderBrush = FindResource("Brush.WindowBorder") as Brush;
BorderThickness = new Thickness(1);
Margin = new Thickness(0);
Loaded += (o, e) => {
var owner = Parent as Window;
if (owner != null) {
owner.StateChanged += (o1, e1) => {
if (owner.WindowState == WindowState.Maximized) {
BorderThickness = new Thickness(0);
Margin = new Thickness(
(SystemParameters.MaximizedPrimaryScreenWidth - SystemParameters.WorkArea.Width) / 2
);
} else {
BorderThickness = new Thickness(1);
Margin = new Thickness(0);
}
};
}
};
}
}
}

View file

@ -1,147 +1,138 @@
<Window x:Class="SourceGit.Views.Histories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
mc:Ignorable="d"
Title="{StaticResource Text.FileHistory}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
RenderOptions.ClearTypeHint="Enabled"
UseLayoutRounding="True"
WindowStartupLocation="CenterOwner"
MinHeight="600" MinWidth="800">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.Histories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
mc:Ignorable="d"
Title="{StaticResource Text.FileHistory}"
WindowStartupLocation="CenterOwner"
MinHeight="600" MinWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Histories}"/>
<!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Histories}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.FileHistory}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.FileHistory}"/>
<!-- Window Commands -->
<StackPanel Grid.Column="3" Orientation="Horizontal" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<!-- Window Commands -->
<StackPanel Grid.Column="3" Orientation="Horizontal" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<Rectangle
Grid.Row="1"
Height="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Body -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Body -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Commit List -->
<DataGrid
x:Name="commitList"
Grid.Column="0"
Background="{StaticResource Brush.Contents}"
BorderBrush="{StaticResource Brush.Border0}"
BorderThickness="0,0,1,0"
SelectionMode="Single"
SelectionUnit="FullRow"
SelectedCellsChanged="OnCommitSelectedChanged">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="{x:Type models:Commit}">
<Border BorderBrush="{StaticResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Commit List -->
<DataGrid
x:Name="commitList"
Grid.Column="0"
Background="{StaticResource Brush.Contents}"
BorderBrush="{StaticResource Brush.Border0}"
BorderThickness="0,0,1,0"
SelectionMode="Single"
SelectionUnit="FullRow"
SelectedCellsChanged="OnCommitSelectedChanged">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="{x:Type models:Commit}">
<Border BorderBrush="{StaticResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<controls:Avatar
Grid.Column="0"
HorizontalAlignment="Center"
Width="32" Height="32"
Email="{Binding Author.Email}"
FallbackLabel="{Binding Author.Name}"
ToolTip="{Binding Author.Name}"/>
<controls:Avatar
Grid.Column="0"
HorizontalAlignment="Center"
Width="32" Height="32"
Email="{Binding Author.Email}"
FallbackLabel="{Binding Author.Name}"
ToolTip="{Binding Author.Name}"/>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontSize="9pt" FontFamily="Consolas">
<TextBlock Grid.Column="0" FontSize="9pt" FontFamily="Consolas">
<Hyperlink NavigateUri="{Binding SHA}" RequestNavigate="GotoCommit" Foreground="DarkOrange" ToolTip="GOTO COMMIT">
<Run Text="{Binding ShortSHA, Mode=OneWay}"/>
</Hyperlink>
</TextBlock>
<TextBlock
Grid.Column="1"
Text="{Binding Author.Time}"
FontSize="9pt" FontFamily="Consolas"
Foreground="{StaticResource Brush.FG2}"
Margin="4,0,0,0"
HorizontalAlignment="Right"/>
</Grid>
</TextBlock>
<TextBlock
Grid.Row="1"
Text="{Binding Subject}"
FontSize="9pt" FontFamily="Consolas,Microsoft YaHei UI"
Margin="0,6,0,0"/>
Grid.Column="1"
Text="{Binding Author.Time}"
FontSize="9pt" FontFamily="Consolas"
Foreground="{StaticResource Brush.FG2}"
Margin="4,0,0,0"
HorizontalAlignment="Right"/>
</Grid>
<TextBlock
Grid.Row="1"
Text="{Binding Subject}"
FontSize="9pt" FontFamily="Consolas,Microsoft YaHei UI"
Margin="0,6,0,0"/>
</Grid>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<!-- Loading -->
<controls:Loading Grid.Column="0" x:Name="loading" Width="48" Height="48" IsAnimating="True"/>
<!-- Loading -->
<controls:Loading Grid.Column="0" x:Name="loading" Width="48" Height="48" IsAnimating="True"/>
<!-- Splitter -->
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="Transparent"/>
<!-- Splitter -->
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="Transparent"/>
<!-- Diff Viewer -->
<widgets:DiffViewer Grid.Column="2" x:Name="diffViewer" Padding="4"/>
</Grid>
<!-- Diff Viewer -->
<widgets:DiffViewer Grid.Column="2" x:Name="diffViewer" Padding="4"/>
</Grid>
</controls:WindowBorder>
</Window>
</Grid>
</controls:Window>

View file

@ -8,7 +8,7 @@ namespace SourceGit.Views {
/// <summary>
/// 文件历史
/// </summary>
public partial class Histories : Window {
public partial class Histories : Controls.Window {
private string repo = null;
private string file = null;
private bool isLFSEnabled = false;

View file

@ -1,69 +1,60 @@
<Window x:Class="SourceGit.Views.Launcher"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
RenderOptions.ClearTypeHint="Enabled"
UseLayoutRounding="True"
WindowStartupLocation="CenterScreen"
MinWidth="1280" MinHeight="720"
Title="{StaticResource Text.About.Title}"
Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}"
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.Launcher"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
MinWidth="1280" MinHeight="720"
Title="{StaticResource Text.About.Title}"
Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}"
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}">
<controls:DragDropAdornerLayer>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<controls:DragDropAdornerLayer>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Titlebar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<!-- Titlebar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<!-- Bottom border -->
<Rectangle Grid.Column="0" Grid.ColumnSpan="2" Fill="{StaticResource Brush.Border0}" Height="1" VerticalAlignment="Bottom"/>
<!-- Bottom border -->
<Rectangle Grid.Column="0" Grid.ColumnSpan="2" Fill="{StaticResource Brush.Border0}" Height="1" VerticalAlignment="Bottom"/>
<!-- Tabs -->
<widgets:PageTabBar
Grid.Column="0"
x:Name="tabs"
TabAdd="OnTabAdding"
TabSelected="OnTabSelected"
TabClosed="OnTabClosed"/>
<!-- Tabs -->
<widgets:PageTabBar
Grid.Column="0"
x:Name="tabs"
TabAdd="OnTabAdding"
TabSelected="OnTabSelected"
TabClosed="OnTabClosed"/>
<!-- Right controls -->
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Height="27" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="OpenPreference" Width="28" Padding="6" Icon="{StaticResource Icon.Preference}" ToolTip="{StaticResource Text.Launcher.Preference}"/>
<controls:IconButton Click="OpenAbout" Width="28" Padding="6" Icon="{StaticResource Icon.Help}" ToolTip="{StaticResource Text.Launcher.About}"/>
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<!-- Right controls -->
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Height="27" WindowChrome.IsHitTestVisibleInChrome="True">
<controls:IconButton Click="OpenPreference" Width="28" Padding="6" Icon="{StaticResource Icon.Preference}" ToolTip="{StaticResource Text.Launcher.Preference}"/>
<controls:IconButton Click="OpenAbout" Width="28" Padding="6" Icon="{StaticResource Icon.Help}" ToolTip="{StaticResource Text.Launcher.About}"/>
<controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
<controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<!-- Contents -->
<controls:PageContainer x:Name="container" Grid.Row="1"/>
<!-- Contents -->
<controls:PageContainer x:Name="container" Grid.Row="1"/>
<!-- Alerts -->
<widgets:Exceptions
Grid.Row="1"
HorizontalAlignment="Right" VerticalAlignment="Top"
Width="330" Height="Auto"/>
</controls:DragDropAdornerLayer>
</controls:WindowBorder>
</Window>
<!-- Alerts -->
<widgets:Exceptions
Grid.Row="1"
HorizontalAlignment="Right" VerticalAlignment="Top"
Width="330" Height="Auto"/>
</controls:DragDropAdornerLayer>
</controls:Window>

View file

@ -8,7 +8,7 @@ namespace SourceGit.Views {
/// <summary>
/// 主窗体
/// </summary>
public partial class Launcher : Window {
public partial class Launcher : Controls.Window {
public Launcher() {
Models.Watcher.Opened += OpenRepository;

View file

@ -1,314 +1,308 @@
<Window x:Class="SourceGit.Views.Preference"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
UseLayoutRounding="True"
Title="{StaticResource Text.Preference}"
Width="500" SizeToContent="Height">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.Preference"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Title="{StaticResource Text.Preference}"
Width="500" SizeToContent="Height">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<Grid>
<!-- Title bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Width="14" Height="14" Margin="6,0" Data="{StaticResource Icon.Preference}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.Preference}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28" Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<Rectangle
Grid.Row="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Body -->
<Grid Grid.Row="2" Margin="16,8">
<Grid.RowDefinitions>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<!-- Title bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="128"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- General Group -->
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
<TextBlock
Text="{StaticResource Text.Preference.General}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<TextBlock
Text="{StaticResource Text.Preference.RestartRequired}"
Foreground="{StaticResource Brush.FG2}"
Margin="16,0"/>
</StackPanel>
<!-- Language -->
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{StaticResource Text.Preference.Locale}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="1" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:Locale.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Resource"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.Locale, Mode=TwoWay}"/>
<!-- Avatar -->
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{StaticResource Text.Preference.AvatarServer}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:AvatarServer.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Url"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.AvatarServer, Mode=TwoWay}"/>
<!-- Use Dark Theme -->
<CheckBox
Grid.Row="3" Grid.Column="1"
Content="{StaticResource Text.Preference.UseDark}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"/>
<!-- Enable Check For Update -->
<CheckBox
Grid.Row="4" Grid.Column="1"
Content="{StaticResource Text.Preference.CheckUpdate}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
<!-- Auto Fetch -->
<CheckBox
Grid.Row="5" Grid.Column="1"
Content="{StaticResource Text.Preference.AutoFetch}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.AutoFetchRemotes, Mode=TwoWay}"/>
<!-- Git Group -->
<TextBlock
Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2"
Text="{StaticResource Text.Preference.Git}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<!-- Git Executable Path -->
<TextBlock
Grid.Row="8" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="8" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Width="14" Height="14" Margin="6,0" Data="{StaticResource Icon.Preference}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.Preference}"/>
<!-- Close -->
<controls:TextEdit
Grid.Column="0"
x:Name="editGitPath"
Height="24"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.Path, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.Path.Placeholder}"/>
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28" Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
Grid.Column="1"
Click="SelectGitPath"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<Rectangle
Grid.Row="1"
HorizontalAlignment="Stretch"
Fill="{StaticResource Brush.Border0}"/>
<!-- Body -->
<Grid Grid.Row="2" Margin="16,8">
<Grid.RowDefinitions>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<!-- Default Clone Dir -->
<TextBlock
Grid.Row="9" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="9" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="128"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- General Group -->
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
<TextBlock
Text="{StaticResource Text.Preference.General}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<TextBlock
Text="{StaticResource Text.Preference.RestartRequired}"
Foreground="{StaticResource Brush.FG2}"
Margin="16,0"/>
</StackPanel>
<!-- Language -->
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{StaticResource Text.Preference.Locale}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="1" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:Locale.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Resource"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.Locale, Mode=TwoWay}"/>
<!-- Avatar -->
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{StaticResource Text.Preference.AvatarServer}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:AvatarServer.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Url"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.AvatarServer, Mode=TwoWay}"/>
<!-- Use Dark Theme -->
<CheckBox
Grid.Row="3" Grid.Column="1"
Content="{StaticResource Text.Preference.UseDark}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"/>
<!-- Enable Check For Update -->
<CheckBox
Grid.Row="4" Grid.Column="1"
Content="{StaticResource Text.Preference.CheckUpdate}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
<!-- Auto Fetch -->
<CheckBox
Grid.Row="5" Grid.Column="1"
Content="{StaticResource Text.Preference.AutoFetch}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.AutoFetchRemotes, Mode=TwoWay}"/>
<!-- Git Group -->
<TextBlock
Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2"
Text="{StaticResource Text.Preference.Git}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<!-- Git Executable Path -->
<TextBlock
Grid.Row="8" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="8" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
x:Name="editGitPath"
Height="24"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.Path, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.Path.Placeholder}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGitPath"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- Default Clone Dir -->
<TextBlock
Grid.Row="9" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="9" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
x:Name="txtGitCloneDir"
Height="24"
Placeholder="{StaticResource Text.Preference.Git.Dir.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.DefaultCloneDir, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGitCloneDir"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- User -->
<TextBlock
Grid.Row="10" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.User}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<controls:TextEdit
Grid.Row="10" Grid.Column="1"
Grid.Column="0"
x:Name="txtGitCloneDir"
Height="24"
Text="{Binding ElementName=me, Path=User, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.User.Placeholder}"/>
<!-- Email -->
<TextBlock
Grid.Row="11" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Email}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<controls:TextEdit
Grid.Row="11" Grid.Column="1"
Height="24"
Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.Email.Placeholder}"/>
<!-- CRLF -->
<TextBlock
Grid.Row="12" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="12" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}"
SelectedValuePath="Value"
SelectedValue="{Binding ElementName=me, Path=CRLF, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Display}" Margin="2,0"/>
<TextBlock Text="{Binding Desc}" Margin="8,0,0,0" FontSize="10" Foreground="{StaticResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Merge Tool Group -->
<TextBlock
Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="2"
Text="{StaticResource Text.Preference.Merger}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<!-- Merge Tool Type -->
<TextBlock
Grid.Row="15" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="15" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Type"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Type, Mode=TwoWay}"
SelectionChanged="MergeToolChanged"/>
<!-- Merge Tool Executable Path -->
<TextBlock
Grid.Row="16" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="16" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
Height="24"
x:Name="txtMergeExec"
Placeholder="{StaticResource Text.Preference.Merger.Path.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Path, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectMergeTool"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- Merge Tool Command -->
<TextBlock
Grid.Row="17" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Cmd}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<TextBlock
Grid.Row="17" Grid.Column="1"
x:Name="txtMergeCmd"
Text="{Binding ElementName=me, Path=MergeCmd}"
Foreground="{StaticResource Brush.FG2}"/>
Placeholder="{StaticResource Text.Preference.Git.Dir.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.DefaultCloneDir, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGitCloneDir"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- User -->
<TextBlock
Grid.Row="10" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.User}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<controls:TextEdit
Grid.Row="10" Grid.Column="1"
Height="24"
Text="{Binding ElementName=me, Path=User, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.User.Placeholder}"/>
<!-- Email -->
<TextBlock
Grid.Row="11" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.Email}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<controls:TextEdit
Grid.Row="11" Grid.Column="1"
Height="24"
Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}"
Placeholder="{StaticResource Text.Preference.Git.Email.Placeholder}"/>
<!-- CRLF -->
<TextBlock
Grid.Row="12" Grid.Column="0"
Text="{StaticResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="12" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}"
SelectedValuePath="Value"
SelectedValue="{Binding ElementName=me, Path=CRLF, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Display}" Margin="2,0"/>
<TextBlock Text="{Binding Desc}" Margin="8,0,0,0" FontSize="10" Foreground="{StaticResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Merge Tool Group -->
<TextBlock
Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="2"
Text="{StaticResource Text.Preference.Merger}"
FontSize="16" FontWeight="DemiBold"
Foreground="{StaticResource Brush.FG2}"/>
<!-- Merge Tool Type -->
<TextBlock
Grid.Row="15" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="15" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Type"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Type, Mode=TwoWay}"
SelectionChanged="MergeToolChanged"/>
<!-- Merge Tool Executable Path -->
<TextBlock
Grid.Row="16" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<Grid Grid.Row="16" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
Height="24"
x:Name="txtMergeExec"
Placeholder="{StaticResource Text.Preference.Merger.Path.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Path, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectMergeTool"
Width="24" Height="24"
Margin="4,0,0,0" Padding="4"
BorderThickness="1" BorderBrush="{StaticResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- Merge Tool Command -->
<TextBlock
Grid.Row="17" Grid.Column="0"
Text="{StaticResource Text.Preference.Merger.Cmd}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<TextBlock
Grid.Row="17" Grid.Column="1"
x:Name="txtMergeCmd"
Text="{Binding ElementName=me, Path=MergeCmd}"
Foreground="{StaticResource Brush.FG2}"/>
</Grid>
</controls:WindowBorder>
</Window>
</Grid>
</controls:Window>

View file

@ -8,7 +8,7 @@ namespace SourceGit.Views {
/// <summary>
/// 设置面板
/// </summary>
public partial class Preference : Window {
public partial class Preference : Controls.Window {
public string User { get; set; }
public string Email { get; set; }

View file

@ -1,115 +1,112 @@
<Window x:Class="SourceGit.Views.Upgrade"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
UseLayoutRounding="True"
Title="{StaticResource Text.UpdateAvailable}"
WindowStartupLocation="CenterOwner"
Height="400" Width="500"
ResizeMode="NoResize">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:Window
x:Class="SourceGit.Views.Upgrade"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
Title="{StaticResource Text.UpdateAvailable}"
WindowStartupLocation="CenterOwner"
Height="400" Width="500"
ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<controls:WindowBorder>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Width="16" Height="16" Margin="6,0" Data="{StaticResource Icon.Fetch}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.UpdateAvailable}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28" Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<Rectangle Grid.Row="1" Fill="{StaticResource Brush.Border0}" HorizontalAlignment="Stretch" Height="1"/>
<!-- Body -->
<StackPanel Grid.Row="2" Orientation="Vertical" Margin="8,16,8,0">
<!-- Title -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Width="20" Height="20" Data="{StaticResource Icon.Git}" Fill="{StaticResource Brush.Logo}"/>
<TextBlock x:Name="txtRelease" Margin="8,0,0,0" FontSize="18" FontWeight="Bold" Text="Release 1.0 Is Out!!!"/>
</StackPanel>
<!-- Release Info -->
<Grid Margin="0,12,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Width="16" Height="16" Margin="6,0" Data="{StaticResource Icon.Fetch}"/>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.Time}" FontWeight="Bold"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.PublishTime}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.UpdateAvailable}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.Based}" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.CommitSHA}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28" Padding="8"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.IsPreRelease}" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.IsPrerelease}"/>
</Grid>
</StackPanel>
<!-- Body -->
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="8,16,8,0">
<!-- Title -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Width="20" Height="20" Data="{StaticResource Icon.Git}" Fill="{StaticResource Brush.Logo}"/>
<TextBlock x:Name="txtRelease" Margin="8,0,0,0" FontSize="18" FontWeight="Bold" Text="Release 1.0 Is Out!!!"/>
</StackPanel>
<!-- CHANGELOG -->
<Border Grid.Row="3" Margin="8" Background="{StaticResource Brush.Contents}" BorderBrush="{StaticResource Brush.Border1}" BorderThickness="1">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock
FontSize="10pt"
FontFamily="Consolas"
Padding="8"
VerticalAlignment="Top"
Foreground="{StaticResource Brush.FG2}"
Text="{Binding ElementName=me, Path=Version.Body}"/>
</ScrollViewer>
</Border>
<!-- Release Info -->
<Grid Margin="0,12,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<!-- Options -->
<StackPanel Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal">
<Button
Click="Download"
Width="100" Height="24"
Content="{StaticResource Text.UpdateAvailable.Download}"
Background="{StaticResource Brush.Accent1}"
BorderBrush="{StaticResource Brush.FG1}"
BorderThickness="1"/>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.Time}" FontWeight="Bold"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.PublishTime}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.Based}" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.CommitSHA}"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{StaticResource Text.UpdateAvailable.IsPreRelease}" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding ElementName=me, Path=Version.IsPrerelease}"/>
</Grid>
</StackPanel>
<!-- CHANGELOG -->
<Border Grid.Row="2" Margin="8" Background="{StaticResource Brush.Contents}" BorderBrush="{StaticResource Brush.Border1}" BorderThickness="1">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock
FontSize="10pt"
FontFamily="Consolas"
Padding="8"
VerticalAlignment="Top"
Foreground="{StaticResource Brush.FG2}"
Text="{Binding ElementName=me, Path=Version.Body}"/>
</ScrollViewer>
</Border>
<!-- Options -->
<StackPanel Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal">
<Button
Click="Download"
Width="100" Height="24"
Content="{StaticResource Text.UpdateAvailable.Download}"
Background="{StaticResource Brush.Accent1}"
BorderBrush="{StaticResource Brush.FG1}"
BorderThickness="1"/>
<Button
Click="Quit"
Width="100" Height="24"
Margin="8,0,0,0"
Content="{StaticResource Text.Cancel}"/>
</StackPanel>
</Grid>
</controls:WindowBorder>
</Window>
<Button
Click="Quit"
Width="100" Height="24"
Margin="8,0,0,0"
Content="{StaticResource Text.Cancel}"/>
</StackPanel>
</Grid>
</controls:Window>

View file

@ -5,7 +5,7 @@ namespace SourceGit.Views {
/// <summary>
/// 新版本提示窗口
/// </summary>
public partial class Upgrade : Window {
public partial class Upgrade : Controls.Window {
public Models.Version Version { get; set; } = new Models.Version();
public Upgrade(Models.Version ver) {