mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-25 06:04:59 +00:00
enhance: new confirm empty commit dialog (#1143)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
898a8bc69a
commit
506af95963
14 changed files with 144 additions and 14 deletions
72
src/Views/ConfirmEmptyCommit.axaml
Normal file
72
src/Views/ConfirmEmptyCommit.axaml
Normal file
|
@ -0,0 +1,72 @@
|
|||
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||
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:v="using:SourceGit.Views"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.ConfirmEmptyCommit"
|
||||
x:DataType="vm:ConfirmEmptyCommit"
|
||||
x:Name="ThisControl"
|
||||
Icon="/App.ico"
|
||||
Title="{DynamicResource Text.Warn}"
|
||||
SizeToContent="WidthAndHeight"
|
||||
CanResize="False"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto">
|
||||
<!-- TitleBar -->
|
||||
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
|
||||
<Border Background="{DynamicResource Brush.TitleBar}"
|
||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||
PointerPressed="BeginMoveWindow"/>
|
||||
|
||||
<Path Width="14" Height="14"
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Data="{StaticResource Icons.Error}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<TextBlock Classes="bold"
|
||||
Text="{DynamicResource Text.Warn}"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<v:CaptionButtons HorizontalAlignment="Right"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Body -->
|
||||
<Border Grid.Row="1" Margin="16">
|
||||
<TextBlock Text="{DynamicResource Text.ConfirmEmptyCommit.Message}" MaxWidth="520" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="2" Margin="0,0,0,16" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Classes="flat"
|
||||
Height="30"
|
||||
Margin="4,0"
|
||||
IsVisible="{Binding HasLocalChanges}"
|
||||
Click="StageAllThenCommit"
|
||||
Content="{DynamicResource Text.ConfirmEmptyCommit.StageAllThenCommit}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"/>
|
||||
|
||||
<Button Classes="flat"
|
||||
Height="30"
|
||||
Margin="4,0"
|
||||
Click="Continue"
|
||||
Content="{DynamicResource Text.ConfirmEmptyCommit.Continue}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"/>
|
||||
|
||||
<Button Classes="flat primary"
|
||||
Height="30"
|
||||
Margin="4,0"
|
||||
Click="CloseWindow"
|
||||
Content="{DynamicResource Text.Cancel}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</v:ChromelessWindow>
|
29
src/Views/ConfirmEmptyCommit.axaml.cs
Normal file
29
src/Views/ConfirmEmptyCommit.axaml.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public partial class ConfirmEmptyCommit : ChromelessWindow
|
||||
{
|
||||
public ConfirmEmptyCommit()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void StageAllThenCommit(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
(DataContext as ViewModels.ConfirmEmptyCommit)?.StageAllThenCommit();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Continue(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
(DataContext as ViewModels.ConfirmEmptyCommit)?.Continue();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue