sourcegit/src/ViewModels/LauncherPage.cs
leo 1ba294a07b
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
refactor: move auto-fetch from global preference to repository settings
2024-09-26 10:50:21 +08:00

64 lines
1.4 KiB
C#

using System;
using Avalonia.Collections;
namespace SourceGit.ViewModels
{
public class LauncherPage : PopupHost
{
public RepositoryNode Node
{
get => _node;
set => SetProperty(ref _node, value);
}
public object Data
{
get => _data;
set => SetProperty(ref _data, value);
}
public AvaloniaList<Models.Notification> Notifications
{
get;
set;
} = new AvaloniaList<Models.Notification>();
public LauncherPage()
{
_node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
_data = Welcome.Instance;
// New welcome page will clear the search filter before.
Welcome.Instance.ClearSearchFilter();
}
public LauncherPage(RepositoryNode node, Repository repo)
{
_node = node;
_data = repo;
}
public override string GetId()
{
return _node.Id;
}
public override bool IsInProgress()
{
if (_data is Repository { IsAutoFetching: true })
return true;
return base.IsInProgress();
}
public void CopyPath()
{
if (_node.IsRepository)
App.CopyText(_node.Id);
}
private RepositoryNode _node = null;
private object _data = null;
}
}