mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
ux: new layout for Staticstics
window
This commit is contained in:
parent
6151f4dc5f
commit
b9597dc92a
3 changed files with 49 additions and 70 deletions
|
@ -1,5 +1,8 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
|
@ -28,6 +31,25 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _selectedReport, value);
|
||||
}
|
||||
|
||||
public uint SampleColor
|
||||
{
|
||||
get => Preference.Instance.StatisticsSampleColor;
|
||||
set
|
||||
{
|
||||
if (value != Preference.Instance.StatisticsSampleColor)
|
||||
{
|
||||
Preference.Instance.StatisticsSampleColor = value;
|
||||
OnPropertyChanged(nameof(SampleBrush));
|
||||
_selectedReport?.ChangeColor(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IBrush SampleBrush
|
||||
{
|
||||
get => new SolidColorBrush(SampleColor);
|
||||
}
|
||||
|
||||
public Statistics(string repo)
|
||||
{
|
||||
Task.Run(() =>
|
||||
|
@ -47,12 +69,15 @@ namespace SourceGit.ViewModels
|
|||
if (_data == null)
|
||||
return;
|
||||
|
||||
SelectedReport = _selectedIndex switch
|
||||
var report = _selectedIndex switch
|
||||
{
|
||||
0 => _data.All,
|
||||
1 => _data.Month,
|
||||
_ => _data.Week,
|
||||
};
|
||||
|
||||
report.ChangeColor(SampleColor);
|
||||
SelectedReport = report;
|
||||
}
|
||||
|
||||
private bool _isLoading = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue