mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor<Statistics>: use committer instead of author
This commit is contained in:
parent
e070b79d2c
commit
68ddeb4cc5
7 changed files with 174 additions and 208 deletions
|
@ -8,10 +8,17 @@ namespace SourceGit.ViewModels {
|
|||
get => _isLoading;
|
||||
private set => SetProperty(ref _isLoading, value);
|
||||
}
|
||||
|
||||
public int SelectedIndex {
|
||||
get => _selectedIndex;
|
||||
set {
|
||||
if (SetProperty(ref _selectedIndex, value)) RefreshReport();
|
||||
}
|
||||
}
|
||||
|
||||
public Models.Statistics Data {
|
||||
get => _data;
|
||||
private set => SetProperty(ref _data, value);
|
||||
public Models.StatisticsReport SelectedReport {
|
||||
get => _selectedReport;
|
||||
private set => SetProperty(ref _selectedReport, value);
|
||||
}
|
||||
|
||||
public Statistics(string repo) {
|
||||
|
@ -20,14 +27,27 @@ namespace SourceGit.ViewModels {
|
|||
Task.Run(() => {
|
||||
var result = new Commands.Statistics(_repo).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
_data = result;
|
||||
RefreshReport();
|
||||
IsLoading = false;
|
||||
Data = result;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void RefreshReport() {
|
||||
if (_data == null) return;
|
||||
|
||||
switch (_selectedIndex) {
|
||||
case 0: SelectedReport = _data.Year; break;
|
||||
case 1: SelectedReport = _data.Month; break;
|
||||
default: SelectedReport = _data.Week; break;
|
||||
}
|
||||
}
|
||||
|
||||
private string _repo = string.Empty;
|
||||
private bool _isLoading = true;
|
||||
private Models.Statistics _data = null;
|
||||
private Models.StatisticsReport _selectedReport = null;
|
||||
private int _selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue