mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
refactor: use MultiBinding instead of code to control visibility of Commit & Push
button
This commit is contained in:
parent
a10f9e0dd0
commit
9dd4166009
2 changed files with 10 additions and 13 deletions
|
@ -29,11 +29,7 @@ namespace SourceGit.ViewModels
|
||||||
public bool CanCommitWithPush
|
public bool CanCommitWithPush
|
||||||
{
|
{
|
||||||
get => _canCommitWithPush;
|
get => _canCommitWithPush;
|
||||||
set
|
set => SetProperty(ref _canCommitWithPush, value);
|
||||||
{
|
|
||||||
if (SetProperty(ref _canCommitWithPush, value))
|
|
||||||
OnPropertyChanged(nameof(IsCommitWithPushVisible));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasUnsolvedConflicts
|
public bool HasUnsolvedConflicts
|
||||||
|
@ -89,16 +85,10 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
Staged = GetStagedChanges();
|
Staged = GetStagedChanges();
|
||||||
SelectedStaged = [];
|
SelectedStaged = [];
|
||||||
OnPropertyChanged(nameof(IsCommitWithPushVisible));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCommitWithPushVisible
|
|
||||||
{
|
|
||||||
get => !UseAmend && CanCommitWithPush;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Models.Change> Unstaged
|
public List<Models.Change> Unstaged
|
||||||
{
|
{
|
||||||
get => _unstaged;
|
get => _unstaged;
|
||||||
|
|
|
@ -355,8 +355,15 @@
|
||||||
HotKey="Alt+Enter"
|
HotKey="Alt+Enter"
|
||||||
ToolTip.Tip="{OnPlatform Alt+Enter, macOS=⌥+Enter}"
|
ToolTip.Tip="{OnPlatform Alt+Enter, macOS=⌥+Enter}"
|
||||||
ToolTip.Placement="Top"
|
ToolTip.Placement="Top"
|
||||||
ToolTip.VerticalOffset="0"
|
ToolTip.VerticalOffset="0">
|
||||||
IsVisible="{Binding IsCommitWithPushVisible}"/>
|
<Button.IsVisible>
|
||||||
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
|
<Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/>
|
||||||
|
<Binding Path="CanCommitWithPush"/>
|
||||||
|
<Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/>
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.IsVisible>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue