style: add .editorconfig for code formatting. see issu #25

This commit is contained in:
leo 2024-03-18 09:37:06 +08:00
parent a8eeea4f78
commit 18aaa0a143
225 changed files with 7781 additions and 3911 deletions

View file

@ -1,57 +1,74 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels {
public class PopupHost : ObservableObject {
public static PopupHost Active {
namespace SourceGit.ViewModels
{
public class PopupHost : ObservableObject
{
public static PopupHost Active
{
get;
set;
} = null;
public Popup Popup {
public Popup Popup
{
get => _popup;
set => SetProperty(ref _popup, value);
}
public static bool CanCreatePopup() {
public static bool CanCreatePopup()
{
return Active != null && (Active._popup == null || !Active._popup.InProgress);
}
public static void ShowPopup(Popup popup) {
public static void ShowPopup(Popup popup)
{
popup.HostPageId = Active.GetId();
Active.Popup = popup;
}
public static void ShowAndStartPopup(Popup popup) {
public static void ShowAndStartPopup(Popup popup)
{
var dumpPage = Active;
popup.HostPageId = dumpPage.GetId();
dumpPage.Popup = popup;
dumpPage.ProcessPopup();
}
public virtual string GetId() {
public virtual string GetId()
{
return string.Empty;
}
public async void ProcessPopup() {
if (_popup != null) {
public async void ProcessPopup()
{
if (_popup != null)
{
if (!_popup.Check()) return;
_popup.InProgress = true;
var task = _popup.Sure();
if (task != null) {
if (task != null)
{
var finished = await task;
if (finished) {
if (finished)
{
Popup = null;
} else {
}
else
{
_popup.InProgress = false;
}
} else {
}
else
{
Popup = null;
}
}
}
public void CancelPopup() {
public void CancelPopup()
{
if (_popup == null) return;
if (_popup.InProgress) return;
Popup = null;
@ -59,4 +76,4 @@ namespace SourceGit.ViewModels {
private Popup _popup = null;
}
}
}