code_review: PR #515

* remove Linq expressions due to AOT limitations. See https://learn.microsoft.com/zh-cn/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8#limitations-of-native-aot-deployment
* rename `FilteredLocks` to `VisibleLocks`
* use `Commands.Config.Get` instead of `Commands.Config.ListAll`
* disable checkbox if user name is not valid
This commit is contained in:
leo 2024-09-26 15:36:20 +08:00
parent 21498f7009
commit 5d2a442144
No known key found for this signature in database
3 changed files with 67 additions and 52 deletions

View file

@ -5,6 +5,7 @@
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.LFSLocks"
x:DataType="vm:LFSLocks"
@ -44,19 +45,24 @@
</Grid>
<!-- Filter and Unlock All -->
<Grid Grid.Row="1" ColumnDefinitions="Auto,*,Auto" Margin="8,0,0,0">
<CheckBox Grid.Column="0"
Content="Show only my locks"
IsChecked="{Binding ShowOnlyMyLocks}"
IsEnabled="{Binding !IsLoading}"
VerticalAlignment="Center" />
</Grid>
<CheckBox Grid.Row="1"
Margin="8,0,0,0"
Content="Show only my locks"
IsChecked="{Binding ShowOnlyMyLocks, Mode=TwoWay}"
VerticalAlignment="Center">
<CheckBox.IsEnabled>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="HasValidUserName"/>
<Binding Path="!IsLoading"/>
</MultiBinding>
</CheckBox.IsEnabled>
</CheckBox>
<!-- Locked Files -->
<Grid Grid.Row="2">
<ListBox Margin="8,0,8,8"
Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding FilteredLocks}"
ItemsSource="{Binding VisibleLocks}"
SelectionMode="Single"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
@ -98,9 +104,14 @@
</ListBox>
<!-- Empty -->
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsVisible="{Binding IsEmpty}">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="!IsLoading"/>
<Binding Path="VisibleLocks" Converter="{x:Static c:ListConverters.IsNullOrEmpty}"/>
</MultiBinding>
</StackPanel.IsVisible>
<Path Width="48" Height="48" Data="{StaticResource Icons.Empty}" Fill="{DynamicResource Brush.FG2}"/>
<TextBlock Margin="0,16,0,0" Text="{DynamicResource Text.GitLFS.Locks.Empty}" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>