|
|
|
@ -2,11 +2,12 @@
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using AsyncAwaitBestPractices; |
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel; |
|
|
|
|
using CommunityToolkit.Mvvm.Input; |
|
|
|
|
using StabilityMatrix.Avalonia.Models; |
|
|
|
|
|
|
|
|
|
namespace StabilityMatrix.Avalonia.ViewModels.Base; |
|
|
|
|
|
|
|
|
|
public class ViewModelBase : ObservableValidator, IRemovableListItem |
|
|
|
|
public partial class ViewModelBase : ObservableValidator, IRemovableListItem |
|
|
|
|
{ |
|
|
|
|
private WeakEventManager? parentListRemoveRequestedEventManager; |
|
|
|
|
|
|
|
|
@ -20,23 +21,22 @@ public class ViewModelBase : ObservableValidator, IRemovableListItem
|
|
|
|
|
remove => parentListRemoveRequestedEventManager?.RemoveEventHandler(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void RemoveFromParentList() => parentListRemoveRequestedEventManager?.RaiseEvent( |
|
|
|
|
this, EventArgs.Empty, nameof(ParentListRemoveRequested)); |
|
|
|
|
[RelayCommand] |
|
|
|
|
protected void RemoveFromParentList() => |
|
|
|
|
parentListRemoveRequestedEventManager?.RaiseEvent( |
|
|
|
|
this, |
|
|
|
|
EventArgs.Empty, |
|
|
|
|
nameof(ParentListRemoveRequested) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
public virtual void OnLoaded() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
public virtual void OnLoaded() { } |
|
|
|
|
|
|
|
|
|
public virtual Task OnLoadedAsync() |
|
|
|
|
{ |
|
|
|
|
return Task.CompletedTask; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void OnUnloaded() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
public virtual void OnUnloaded() { } |
|
|
|
|
|
|
|
|
|
public virtual Task OnUnloadedAsync() |
|
|
|
|
{ |
|
|
|
|