2024-03-17 18:37:06 -07:00
|
|
|
|
using System;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
using Avalonia.Collections;
|
|
|
|
|
|
|
|
|
|
namespace SourceGit.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class LauncherPage : PopupHost
|
|
|
|
|
{
|
|
|
|
|
public RepositoryNode Node
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _node;
|
|
|
|
|
set => SetProperty(ref _node, value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public object Data
|
|
|
|
|
{
|
2024-03-02 06:45:14 -08:00
|
|
|
|
get => _data;
|
|
|
|
|
set => SetProperty(ref _data, value);
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:44:13 -07:00
|
|
|
|
public AvaloniaList<Models.Notification> Notifications
|
2024-03-17 18:37:06 -07:00
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get;
|
|
|
|
|
set;
|
2024-07-23 20:44:13 -07:00
|
|
|
|
} = new AvaloniaList<Models.Notification>();
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public LauncherPage()
|
|
|
|
|
{
|
2024-05-06 19:34:04 -07:00
|
|
|
|
_node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
|
2024-05-06 23:12:33 -07:00
|
|
|
|
_data = Welcome.Instance;
|
2024-08-27 22:42:25 -07:00
|
|
|
|
|
2024-08-25 03:31:05 -07:00
|
|
|
|
// New welcome page will clear the search filter before.
|
|
|
|
|
Welcome.Instance.ClearSearchFilter();
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public LauncherPage(RepositoryNode node, Repository repo)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_node = node;
|
2024-03-02 06:45:14 -08:00
|
|
|
|
_data = repo;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public override string GetId()
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
return _node.Id;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-25 19:50:21 -07:00
|
|
|
|
public override bool IsInProgress()
|
|
|
|
|
{
|
|
|
|
|
if (_data is Repository { IsAutoFetching: true })
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return base.IsInProgress();
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public void CopyPath()
|
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
|
if (_node.IsRepository)
|
|
|
|
|
App.CopyText(_node.Id);
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private RepositoryNode _node = null;
|
2024-03-02 06:45:14 -08:00
|
|
|
|
private object _data = null;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
|
}
|