mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
feature<Statistics>: finish statistiscs
This commit is contained in:
parent
49f6ad0407
commit
e070b79d2c
10 changed files with 632 additions and 4 deletions
33
src/ViewModels/Statistics.cs
Normal file
33
src/ViewModels/Statistics.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels {
|
||||
public class Statistics : ObservableObject {
|
||||
public bool IsLoading {
|
||||
get => _isLoading;
|
||||
private set => SetProperty(ref _isLoading, value);
|
||||
}
|
||||
|
||||
public Models.Statistics Data {
|
||||
get => _data;
|
||||
private set => SetProperty(ref _data, value);
|
||||
}
|
||||
|
||||
public Statistics(string repo) {
|
||||
_repo = repo;
|
||||
|
||||
Task.Run(() => {
|
||||
var result = new Commands.Statistics(_repo).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
IsLoading = false;
|
||||
Data = result;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private string _repo = string.Empty;
|
||||
private bool _isLoading = true;
|
||||
private Models.Statistics _data = null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue