style: add .editorconfig for code formatting. see issu #25

This commit is contained in:
leo 2024-03-18 09:37:06 +08:00
parent a8eeea4f78
commit 18aaa0a143
225 changed files with 7781 additions and 3911 deletions

View file

@ -1,49 +1,66 @@
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SourceGit.ViewModels {
public class FileHistories : ObservableObject {
public string File {
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
{
public class FileHistories : ObservableObject
{
public string File
{
get => _file;
}
public bool IsLoading {
public bool IsLoading
{
get => _isLoading;
private set => SetProperty(ref _isLoading, value);
}
public List<Models.Commit> Commits {
public List<Models.Commit> Commits
{
get => _commits;
set => SetProperty(ref _commits, value);
}
public Models.Commit SelectedCommit {
public Models.Commit SelectedCommit
{
get => _selectedCommit;
set {
if (SetProperty(ref _selectedCommit, value)) {
if (value == null) {
set
{
if (SetProperty(ref _selectedCommit, value))
{
if (value == null)
{
DiffContext = null;
} else {
}
else
{
DiffContext = new DiffContext(_repo, new Models.DiffOption(value, _file));
}
}
}
}
public DiffContext DiffContext {
public DiffContext DiffContext
{
get => _diffContext;
set => SetProperty(ref _diffContext, value);
}
public FileHistories(string repo, string file) {
public FileHistories(string repo, string file)
{
_repo = repo;
_file = file;
Task.Run(() => {
Task.Run(() =>
{
var commits = new Commands.QueryCommits(_repo, $"-n 10000 -- \"{file}\"").Result();
Dispatcher.UIThread.Invoke(() => {
Dispatcher.UIThread.Invoke(() =>
{
IsLoading = false;
Commits = commits;
if (commits.Count > 0) SelectedCommit = commits[0];
@ -51,16 +68,17 @@ namespace SourceGit.ViewModels {
});
}
public void NavigateToCommit(string commitSHA) {
public void NavigateToCommit(string commitSHA)
{
var repo = Preference.FindRepository(_repo);
if (repo != null) repo.NavigateToCommit(commitSHA);
}
private string _repo = string.Empty;
private string _file = string.Empty;
private readonly string _repo = string.Empty;
private readonly string _file = string.Empty;
private bool _isLoading = true;
private List<Models.Commit> _commits = null;
private Models.Commit _selectedCommit = null;
private DiffContext _diffContext = null;
}
}
}