mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 05:35:00 +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
31
src/ViewModels/ConfirmEmptyCommit.cs
Normal file
31
src/ViewModels/ConfirmEmptyCommit.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class ConfirmEmptyCommit
|
||||
{
|
||||
public bool HasLocalChanges
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public ConfirmEmptyCommit(bool hasLocalChanges, Action<bool> onSure)
|
||||
{
|
||||
HasLocalChanges = hasLocalChanges;
|
||||
_onSure = onSure;
|
||||
}
|
||||
|
||||
public void StageAllThenCommit()
|
||||
{
|
||||
_onSure?.Invoke(true);
|
||||
}
|
||||
|
||||
public void Continue()
|
||||
{
|
||||
_onSure?.Invoke(false);
|
||||
}
|
||||
|
||||
private Action<bool> _onSure;
|
||||
}
|
||||
}
|
|
@ -1679,12 +1679,11 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
if ((autoStage && _count == 0) || (!autoStage && _staged.Count == 0))
|
||||
{
|
||||
var confirmMessage = App.Text("WorkingCopy.ConfirmCommitWithoutFiles");
|
||||
App.OpenDialog(new Views.ConfirmCommit()
|
||||
App.OpenDialog(new Views.ConfirmEmptyCommit()
|
||||
{
|
||||
DataContext = new ConfirmCommit(confirmMessage, () =>
|
||||
DataContext = new ConfirmEmptyCommit(_count > 0, stageAll =>
|
||||
{
|
||||
DoCommit(autoStage, autoPush, true, confirmWithFilter);
|
||||
DoCommit(stageAll, autoPush, true, confirmWithFilter);
|
||||
})
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue