mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
refactor: code cleanup
This commit is contained in:
parent
04f4293421
commit
fa3a3b2dad
25 changed files with 174 additions and 233 deletions
|
@ -11,51 +11,6 @@ using Avalonia.VisualTree;
|
|||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public class RepositorySubView : Border
|
||||
{
|
||||
public static readonly StyledProperty<object> DataProperty =
|
||||
AvaloniaProperty.Register<RepositorySubView, object>(nameof(Data), false);
|
||||
|
||||
public object Data
|
||||
{
|
||||
get => GetValue(DataProperty);
|
||||
set => SetValue(DataProperty, value);
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(Border);
|
||||
|
||||
static RepositorySubView()
|
||||
{
|
||||
DataProperty.Changed.AddClassHandler<RepositorySubView>((view, ev) =>
|
||||
{
|
||||
var data = view.Data;
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
view.Child = null;
|
||||
}
|
||||
else if (data is ViewModels.Histories)
|
||||
{
|
||||
view.Child = new Histories { DataContext = data };
|
||||
}
|
||||
else if (data is ViewModels.WorkingCopy)
|
||||
{
|
||||
view.Child = new WorkingCopy { DataContext = data };
|
||||
}
|
||||
else if (data is ViewModels.StashesPage)
|
||||
{
|
||||
view.Child = new StashesPage { DataContext = data };
|
||||
}
|
||||
else
|
||||
{
|
||||
view.Child = null;
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Repository : UserControl
|
||||
{
|
||||
public Repository()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue