feature: workspace support (#445)

This commit is contained in:
leo 2024-09-09 18:26:43 +08:00
parent acd6171350
commit ebc112a627
No known key found for this signature in database
27 changed files with 473 additions and 109 deletions

View file

@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
{
public class Workspace : ObservableObject
{
public string Name
{
get => _name;
set => SetProperty(ref _name, value);
}
public uint Color
{
get => _color;
set
{
if (SetProperty(ref _color, value))
Brush = new SolidColorBrush(value);
}
}
public List<string> Repositories
{
get;
set;
} = new List<string>();
public bool IsActive
{
get => _isActive;
set => SetProperty(ref _isActive, value);
}
[JsonIgnore]
public IBrush Brush
{
get => _brush;
private set => SetProperty(ref _brush, value);
}
public void AddRepository(string repo)
{
if (!Repositories.Contains(repo))
Repositories.Add(repo);
}
private string _name = string.Empty;
private uint _color = 0;
private IBrush _brush = null;
private bool _isActive = false;
}
}