refactor: code cleanup

This commit is contained in:
leo 2024-05-30 15:13:59 +08:00
parent 04f4293421
commit fa3a3b2dad
25 changed files with 174 additions and 233 deletions

View file

@ -2,6 +2,7 @@
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using CommunityToolkit.Mvvm.ComponentModel;
@ -40,20 +41,21 @@ namespace SourceGit.ViewModels
}
}
public void Clone(object param)
public void Clone()
{
var launcher = param as Launcher;
var page = launcher.ActivePage;
if (!Preference.Instance.IsGitConfigured)
{
App.RaiseException(page.GetId(), App.Text("NotConfigured"));
App.RaiseException(string.Empty, App.Text("NotConfigured"));
return;
}
if (PopupHost.CanCreatePopup())
{
PopupHost.ShowPopup(new Clone(launcher, page));
if (App.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var launcher = desktop.MainWindow.DataContext as Launcher;
PopupHost.ShowPopup(new Clone(launcher));
}
}
}