feature<Histories>: add usage guide for histories panel.

This commit is contained in:
leo 2020-11-26 13:18:03 +08:00
parent 757c64e49c
commit b3b014f84e
2 changed files with 21 additions and 5 deletions

View file

@ -172,13 +172,26 @@
<local:TwoCommitsDiff x:Name="twoCommitDiff" Visibility="Collapsed"/>
<!-- Mask for select multi rows in commit list -->
<Border x:Name="mask4MultiSelection" Background="{StaticResource Brush.BG1}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".2">
<Border x:Name="selectionCounter" Background="{StaticResource Brush.BG1}" Visibility="Collapsed">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".25">
<Path Width="160" Height="160" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Git}"/>
<Label x:Name="txtTotalSelected" Content="SELECT TO VIEW DETAIL" FontFamily="Consolas" Margin="0,16,0,0" FontSize="24" FontWeight="UltraBold" HorizontalAlignment="Center"/>
</StackPanel>
</Border>
<!-- Usage Page -->
<Border x:Name="welcome" Background="{StaticResource Brush.BG1}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".25">
<Path Width="120" Height="120" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Git}"/>
<Label Content="HISTORIES GUIDE" FontFamily="Consolas" FontWeight="ExtraBold" FontSize="24" HorizontalAlignment="Center" Margin="0,32,0,16"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" TextElement.FontFamily="Consolas" TextElement.FontSize="16" Margin="16,0,0,0">
<Label Margin="0" Padding="1" Content="1. Select 1 commit to view detail info"/>
<Label Margin="0" Padding="1" Content="2. Select 2 commits to show differences"/>
<Label Margin="0" Padding="1" Content="3. Select more than 2 commits to count"/>
</StackPanel>
</StackPanel>
</Border>
<!-- SWITCH LAYOUT -->
<ToggleButton
HorizontalAlignment="Right"

View file

@ -269,19 +269,22 @@ namespace SourceGit.UI {
}
private void CommitSelectChanged(object sender, SelectionChangedEventArgs e) {
mask4MultiSelection.Visibility = Visibility.Collapsed;
selectionCounter.Visibility = Visibility.Collapsed;
commitViewer.Visibility = Visibility.Collapsed;
twoCommitDiff.Visibility = Visibility.Collapsed;
welcome.Visibility = Visibility.Collapsed;
var selected = commitList.SelectedItems;
if (selected.Count == 1) {
if (selected.Count == 0) {
welcome.Visibility = Visibility.Visible;
} else if (selected.Count == 1) {
commitViewer.Visibility = Visibility.Visible;
commitViewer.SetData(Repo, selected[0] as Git.Commit);
} else if (selected.Count == 2) {
twoCommitDiff.Visibility = Visibility.Visible;
twoCommitDiff.SetData(Repo, (selected[0] as Git.Commit).ShortSHA, (selected[1] as Git.Commit).ShortSHA);
} else {
mask4MultiSelection.Visibility = Visibility.Visible;
selectionCounter.Visibility = Visibility.Visible;
txtTotalSelected.Content = $"SELECTED {selected.Count} COMMITS";
}
}