Skip to content

Commit b777993

Browse files
committed
code_style: remove unnecessary converters
Signed-off-by: leo <longshuang@msn.cn>
1 parent 2e02461 commit b777993

3 files changed

Lines changed: 8 additions & 18 deletions

File tree

‎src/Converters/IntConverters.cs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ public static class IntConverters
1414
public static readonly FuncValueConverter<int, bool> IsZero =
1515
new(v => v == 0);
1616

17-
public static readonly FuncValueConverter<int, bool> IsOne =
18-
new(v => v == 1);
19-
20-
public static readonly FuncValueConverter<int, bool> IsNotOne =
21-
new(v => v != 1);
22-
2317
public static readonly FuncValueConverter<int, Thickness> ToTreeMargin =
2418
new(v => new Thickness(v * 16, 0, 0, 0));
2519

‎src/Views/LauncherPage.axaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@
4343
<v:Repository>
4444
<v:Repository.IsCommitSearchPanelVisible>
4545
<MultiBinding Converter="{x:Static BoolConverters.And}">
46-
<Binding Path="SelectedViewIndex" Converter="{x:Static c:IntConverters.IsZero}"/>
46+
<Binding Path="IsDashboardVisible"/>
4747
<Binding Path="Histories.IsSearchingCommits"/>
4848
</MultiBinding>
4949
</v:Repository.IsCommitSearchPanelVisible>
5050

5151
<v:Repository.IsNormalSidebarVisible>
5252
<MultiBinding Converter="{x:Static BoolConverters.Or}">
5353
<MultiBinding Converter="{x:Static BoolConverters.And}">
54-
<Binding Path="SelectedViewIndex" Converter="{x:Static c:IntConverters.IsZero}"/>
54+
<Binding Path="IsDashboardVisible"/>
5555
<Binding Path="Histories.IsSearchingCommits" Converter="{x:Static BoolConverters.Not}"/>
5656
</MultiBinding>
5757
<MultiBinding Converter="{x:Static BoolConverters.And}">
58-
<Binding Path="SelectedViewIndex" Converter="{x:Static c:IntConverters.IsOne}"/>
58+
<Binding Path="IsWorkingCopyVisible"/>
5959
<Binding Source="{x:Static vm:Preferences.Instance}" Path="Layout.IsSidebarCollapsedInLocalChanges" Converter="{x:Static BoolConverters.Not}"/>
6060
</MultiBinding>
6161
</MultiBinding>

‎src/Views/Repository.axaml‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
Content="{DynamicResource Text.Repository.Resolve}"
228228
Padding="8,2" Margin="0,0,8,0"
229229
Click="OnResolveInProgress"
230-
IsVisible="{Binding SelectedViewIndex, Converter={x:Static c:IntConverters.IsNotOne}}"/>
230+
IsVisible="{Binding !IsWorkingCopyVisible}"/>
231231

232232
<Button Grid.Column="2"
233233
Classes="flat"
@@ -684,14 +684,10 @@
684684
</Grid>
685685

686686
<!-- History Filter Bar -->
687-
<Border Grid.Row="1" Background="{DynamicResource Brush.Popup}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
688-
<Border.IsVisible>
689-
<MultiBinding Converter="{x:Static BoolConverters.And}">
690-
<Binding Path="SelectedViewIndex" Converter="{x:Static c:IntConverters.IsZero}"/>
691-
<Binding Path="UIStates.HistoryFilters.Count" Converter="{x:Static c:IntConverters.IsGreaterThanZero}"/>
692-
</MultiBinding>
693-
</Border.IsVisible>
694-
687+
<Border Grid.Row="1"
688+
Background="{DynamicResource Brush.Popup}"
689+
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
690+
IsVisible="{Binding UIStates.HistoryFilters.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
695691
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
696692
<Path Grid.Column="0"
697693
Margin="8,0,0,0"

0 commit comments

Comments
 (0)