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.Logo" Color="#FFF05133"/>
<SolidColorBrush x:Key="Brush.Window" Color="#FFF8F8F8"/> <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.TitleBar" Color="White"/>
<SolidColorBrush x:Key="Brush.NewPageHover" Color="#1D000000"/> <SolidColorBrush x:Key="Brush.NewPageHover" Color="#1D000000"/>

View file

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

View file

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

View file

@ -1,148 +1,139 @@
<Window x:Class="SourceGit.Views.Blame" <controls:Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Class="SourceGit.Views.Blame"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:controls="clr-namespace:SourceGit.Views.Controls"
Title="{StaticResource Text.Blame}" mc:Ignorable="d"
TextOptions.TextFormattingMode="Display" Title="{StaticResource Text.Blame}"
TextOptions.TextRenderingMode="ClearType" WindowStartupLocation="CenterOwner"
RenderOptions.ClearTypeHint="Enabled" Height="600" Width="800">
UseLayoutRounding="True" <Grid>
WindowStartupLocation="CenterOwner" <Grid.RowDefinitions>
Height="600" Width="800"> <RowDefinition Height="28"/>
<WindowChrome.WindowChrome> <RowDefinition Height="1"/>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/> <RowDefinition Height="24"/>
</WindowChrome.WindowChrome> <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:WindowBorder> <!-- Title Bar -->
<Grid> <Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.RowDefinitions> <Grid.ColumnDefinitions>
<RowDefinition Height="28"/> <ColumnDefinition Width="Auto"/>
<RowDefinition Height="1"/> <ColumnDefinition Width="Auto"/>
<RowDefinition Height="24"/> <ColumnDefinition Width="*"/>
<RowDefinition Height="*"/> <ColumnDefinition Width="Auto"/>
</Grid.RowDefinitions> </Grid.ColumnDefinitions>
<!-- Title Bar --> <!-- Icon -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}"> <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> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Icon --> <TextBlock Grid.Column="0" x:Name="txtFile" FontSize="11" Foreground="{StaticResource Brush.FG2}" FontFamily="Consolas"/>
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Commit}"/> <TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{StaticResource Brush.FG2}" FontFamily="11" Text="{StaticResource Text.Blame.Tip}"/>
<!-- 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> </Grid>
</Border>
<!-- Line --> <!-- Viewer -->
<Rectangle <DataGrid
Grid.Row="1" Grid.Row="3"
Height="1" x:Name="blame"
HorizontalAlignment="Stretch" GridLinesVisibility="Vertical"
Fill="{StaticResource Brush.Border0}"/> 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> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txtFile" FontSize="11" Foreground="{StaticResource Brush.FG2}" FontFamily="Consolas"/> <TextBlock Grid.Row="0" Grid.Column="0" Text="{StaticResource Text.Blame.SHA}" Foreground="{StaticResource Brush.FG2}" Margin="4,0"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{StaticResource Brush.FG2}" FontFamily="11" Text="{StaticResource Text.Blame.Tip}"/> <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> </Grid>
</Border> </Border>
</Popup>
<!-- Viewer --> </Grid>
<DataGrid </controls:Window>
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>

View file

@ -11,7 +11,7 @@ namespace SourceGit.Views {
/// <summary> /// <summary>
/// 逐行追溯 /// 逐行追溯
/// </summary> /// </summary>
public partial class Blame : Window { public partial class Blame : Controls.Window {
private static readonly Brush[] BG = new Brush[] { private static readonly Brush[] BG = new Brush[] {
Brushes.Transparent, Brushes.Transparent,
new SolidColorBrush(Color.FromArgb(128, 0, 0, 0)) 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" <controls:Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Class="SourceGit.Views.Histories"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:SourceGit.Models" xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets" xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d" xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
Title="{StaticResource Text.FileHistory}" mc:Ignorable="d"
TextOptions.TextFormattingMode="Display" Title="{StaticResource Text.FileHistory}"
TextOptions.TextRenderingMode="ClearType" WindowStartupLocation="CenterOwner"
RenderOptions.ClearTypeHint="Enabled" MinHeight="600" MinWidth="800">
UseLayoutRounding="True" <Grid>
WindowStartupLocation="CenterOwner" <Grid.RowDefinitions>
MinHeight="600" MinWidth="800"> <RowDefinition Height="28"/>
<WindowChrome.WindowChrome> <RowDefinition Height="1"/>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/> <RowDefinition Height="*"/>
</WindowChrome.WindowChrome> </Grid.RowDefinitions>
<controls:WindowBorder> <!-- Title Bar -->
<Grid> <Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.RowDefinitions> <Grid.ColumnDefinitions>
<RowDefinition Height="28"/> <ColumnDefinition Width="Auto"/>
<RowDefinition Height="1"/> <ColumnDefinition Width="Auto"/>
<RowDefinition Height="*"/> <ColumnDefinition Width="*"/>
</Grid.RowDefinitions> <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 --> <!-- Icon -->
<Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Histories}"/> <Path Grid.Column="0" Margin="6,0" Width="16" Height="16" Data="{StaticResource Icon.Histories}"/>
<!-- Title --> <!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.FileHistory}"/> <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>
<Rectangle <!-- Window Commands -->
Grid.Row="1" <StackPanel Grid.Column="3" Orientation="Horizontal" WindowChrome.IsHitTestVisibleInChrome="True">
Height="1" <controls:IconButton Click="Minimize" Width="28" Padding="8" Icon="{StaticResource Icon.Minimize}" HoverBackground="#40000000" Opacity="1"/>
HorizontalAlignment="Stretch" <controls:IconButton Click="MaximizeOrRestore" Width="28" Padding="8" Icon="{StaticResource Icon.Maximize}" HoverBackground="#40000000" Opacity="1"/>
Fill="{StaticResource Brush.Border0}"/> <controls:IconButton Click="Quit" Width="28" Padding="8" Icon="{StaticResource Icon.Close}" HoverBackground="Red" Opacity="1"/>
</StackPanel>
</Grid>
<!-- Body --> <Rectangle
<Grid Grid.Row="2"> Grid.Row="1"
<Grid.ColumnDefinitions> Height="1"
<ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/> HorizontalAlignment="Stretch"
<ColumnDefinition Width="1"/> Fill="{StaticResource Brush.Border0}"/>
<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 <!-- Body -->
Grid.Column="0" <Grid Grid.Row="2">
HorizontalAlignment="Center" <Grid.ColumnDefinitions>
Width="32" Height="32" <ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/>
Email="{Binding Author.Email}" <ColumnDefinition Width="1"/>
FallbackLabel="{Binding Author.Name}" <ColumnDefinition Width="*"/>
ToolTip="{Binding Author.Name}"/> </Grid.ColumnDefinitions>
<Grid Grid.Column="1" Margin="8,0,0,0"> <!-- Commit List -->
<Grid.RowDefinitions> <DataGrid
<RowDefinition Height="Auto"/> x:Name="commitList"
<RowDefinition Height="Auto"/> Grid.Column="0"
</Grid.RowDefinitions> 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>
<Grid Grid.Row="0"> <controls:Avatar
<Grid.ColumnDefinitions> Grid.Column="0"
<ColumnDefinition Width="72"/> HorizontalAlignment="Center"
<ColumnDefinition Width="*"/> Width="32" Height="32"
</Grid.ColumnDefinitions> Email="{Binding Author.Email}"
FallbackLabel="{Binding Author.Name}"
ToolTip="{Binding Author.Name}"/>
<TextBlock Grid.Column="0" FontSize="9pt" FontFamily="Consolas"> <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>
<TextBlock Grid.Column="0" FontSize="9pt" FontFamily="Consolas">
<Hyperlink NavigateUri="{Binding SHA}" RequestNavigate="GotoCommit" Foreground="DarkOrange" ToolTip="GOTO COMMIT"> <Hyperlink NavigateUri="{Binding SHA}" RequestNavigate="GotoCommit" Foreground="DarkOrange" ToolTip="GOTO COMMIT">
<Run Text="{Binding ShortSHA, Mode=OneWay}"/> <Run Text="{Binding ShortSHA, Mode=OneWay}"/>
</Hyperlink> </Hyperlink>
</TextBlock> </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" Grid.Column="1"
Text="{Binding Subject}" Text="{Binding Author.Time}"
FontSize="9pt" FontFamily="Consolas,Microsoft YaHei UI" FontSize="9pt" FontFamily="Consolas"
Margin="0,6,0,0"/> Foreground="{StaticResource Brush.FG2}"
Margin="4,0,0,0"
HorizontalAlignment="Right"/>
</Grid> </Grid>
</Grid>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 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"/>
<!-- Diff Viewer --> <TextBlock
<widgets:DiffViewer Grid.Column="2" x:Name="diffViewer" Padding="4"/> Grid.Row="1"
</Grid> Text="{Binding Subject}"
FontSize="9pt" FontFamily="Consolas,Microsoft YaHei UI"
Margin="0,6,0,0"/>
</Grid>
</Grid>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 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"/>
<!-- Diff Viewer -->
<widgets:DiffViewer Grid.Column="2" x:Name="diffViewer" Padding="4"/>
</Grid> </Grid>
</controls:WindowBorder> </Grid>
</Window> </controls:Window>

View file

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

View file

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

View file

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

View file

@ -1,314 +1,308 @@
<Window x:Class="SourceGit.Views.Preference" <controls:Window
x:Name="me" x:Class="SourceGit.Views.Preference"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Name="me"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:SourceGit.Models" xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d" xmlns:models="clr-namespace:SourceGit.Models"
WindowStartupLocation="CenterOwner" mc:Ignorable="d"
ResizeMode="NoResize" WindowStartupLocation="CenterOwner"
UseLayoutRounding="True" ResizeMode="NoResize"
Title="{StaticResource Text.Preference}" Title="{StaticResource Text.Preference}"
Width="500" SizeToContent="Height"> Width="500" SizeToContent="Height">
<WindowChrome.WindowChrome> <Grid>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/> <Grid.RowDefinitions>
</WindowChrome.WindowChrome> <RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<controls:WindowBorder> <RowDefinition Height="*"/>
<Grid> </Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title bar --> <!-- Title bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}"> <Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Icon --> <!-- Icon -->
<Path Grid.Column="0" Width="14" Height="14" Margin="6,0" Data="{StaticResource Icon.Preference}"/> <Path Grid.Column="0" Width="14" Height="14" Margin="6,0" Data="{StaticResource Icon.Preference}"/>
<!-- Title --> <!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.Preference}"/> <TextBlock Grid.Column="1" Text="{StaticResource Text.Preference}"/>
<!-- Close --> <!-- Close -->
<controls:IconButton <controls:IconButton
Grid.Column="3" Grid.Column="3"
Click="Quit" Click="Quit"
Width="28" Padding="8" Width="28" Padding="8"
Icon="{StaticResource Icon.Close}" Icon="{StaticResource Icon.Close}"
HoverBackground="Red" HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/> 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="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>
<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="*"/>
<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"
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>
</Grid> </Grid>
</controls:WindowBorder>
</Window> <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>
<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="*"/>
<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"
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>
</Grid>
</controls:Window>

View file

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

View file

@ -1,115 +1,112 @@
<Window x:Class="SourceGit.Views.Upgrade" <controls:Window
x:Name="me" x:Class="SourceGit.Views.Upgrade"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Name="me"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:controls="clr-namespace:SourceGit.Views.Controls"
UseLayoutRounding="True" mc:Ignorable="d"
Title="{StaticResource Text.UpdateAvailable}" Title="{StaticResource Text.UpdateAvailable}"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"
Height="400" Width="500" Height="400" Width="500"
ResizeMode="NoResize"> ResizeMode="NoResize">
<WindowChrome.WindowChrome> <Grid>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/> <Grid.RowDefinitions>
</WindowChrome.WindowChrome> <RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<controls:WindowBorder> <RowDefinition Height="Auto"/>
<Grid> <RowDefinition Height="*"/>
<Grid.RowDefinitions> <RowDefinition Height="32"/>
<RowDefinition Height="28"/> </Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<!-- Title Bar --> <!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}"> <Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Icon --> <!-- Icon -->
<Path Grid.Column="0" Width="16" Height="16" Margin="6,0" Data="{StaticResource Icon.Fetch}"/> <Path Grid.Column="0" Width="16" Height="16" Margin="6,0" Data="{StaticResource Icon.Fetch}"/>
<!-- Title --> <!-- Title -->
<TextBlock Grid.Column="1" Text="{StaticResource Text.UpdateAvailable}"/> <TextBlock Grid.Column="1" Text="{StaticResource Text.UpdateAvailable}"/>
<!-- Close --> <!-- Close -->
<controls:IconButton <controls:IconButton
Grid.Column="3" Grid.Column="3"
Click="Quit" Click="Quit"
Width="28" Padding="8" Width="28" Padding="8"
Icon="{StaticResource Icon.Close}" Icon="{StaticResource Icon.Close}"
HoverBackground="Red" HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/> WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<!-- 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>
<!-- Release Info -->
<Grid Margin="0,12,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<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> </Grid>
</controls:WindowBorder>
</Window> <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>
<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="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>
<!-- 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:Window>

View file

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