mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
style: add .editorconfig for code formatting. see issu #25
This commit is contained in:
parent
a8eeea4f78
commit
18aaa0a143
225 changed files with 7781 additions and 3911 deletions
|
@ -1,51 +1,68 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels {
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class DiscardModeAll { }
|
||||
public class DiscardModeSingle { public string File { get; set; } }
|
||||
public class DiscardModeMulti { public int Count { get; set; } }
|
||||
|
||||
public class Discard : Popup {
|
||||
public class Discard : Popup
|
||||
{
|
||||
|
||||
public object Mode {
|
||||
public object Mode
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public Discard(Repository repo) {
|
||||
public Discard(Repository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
|
||||
Mode = new DiscardModeAll();
|
||||
View = new Views.Discard { DataContext = this };
|
||||
}
|
||||
|
||||
public Discard(Repository repo, List<Models.Change> changes, bool isUnstaged) {
|
||||
public Discard(Repository repo, List<Models.Change> changes, bool isUnstaged)
|
||||
{
|
||||
_repo = repo;
|
||||
_changes = changes;
|
||||
_isUnstaged = isUnstaged;
|
||||
|
||||
if (_changes == null) {
|
||||
if (_changes == null)
|
||||
{
|
||||
Mode = new DiscardModeAll();
|
||||
} else if (_changes.Count == 1) {
|
||||
}
|
||||
else if (_changes.Count == 1)
|
||||
{
|
||||
Mode = new DiscardModeSingle() { File = _changes[0].Path };
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Mode = new DiscardModeMulti() { Count = _changes.Count };
|
||||
}
|
||||
|
||||
View = new Views.Discard() { DataContext = this };
|
||||
}
|
||||
|
||||
public override Task<bool> Sure() {
|
||||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = _changes == null ? "Discard all local changes ..." : $"Discard total {_changes.Count} changes ...";
|
||||
|
||||
return Task.Run(() => {
|
||||
if (_changes == null) {
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (_changes == null)
|
||||
{
|
||||
Commands.Discard.All(_repo.FullPath);
|
||||
} else if (_isUnstaged) {
|
||||
}
|
||||
else if (_isUnstaged)
|
||||
{
|
||||
Commands.Discard.ChangesInWorkTree(_repo.FullPath, _changes);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Commands.Discard.ChangesInStaged(_repo.FullPath, _changes);
|
||||
}
|
||||
|
||||
|
@ -54,8 +71,8 @@ namespace SourceGit.ViewModels {
|
|||
});
|
||||
}
|
||||
|
||||
private Repository _repo = null;
|
||||
private List<Models.Change> _changes = null;
|
||||
private bool _isUnstaged = true;
|
||||
private readonly Repository _repo = null;
|
||||
private readonly List<Models.Change> _changes = null;
|
||||
private readonly bool _isUnstaged = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue