using System;
using System.Threading.Tasks;
using Artemis.Core.LayerBrushes;
namespace Artemis.UI.Shared.LayerBrushes
{
///
/// Represents a view model for a brush configuration window
///
public abstract class BrushConfigurationViewModel : ActivatableViewModelBase
{
///
/// Creates a new instance of the class
///
///
protected BrushConfigurationViewModel(BaseLayerBrush layerBrush)
{
LayerBrush = layerBrush;
}
///
/// Gets the layer brush this view model is associated with
///
public BaseLayerBrush LayerBrush { get; }
///
/// Closes the dialog
///
public void RequestClose()
{
CloseRequested?.Invoke(this, EventArgs.Empty);
}
///
/// Called when the window wants to close, returning will cause the window to stay open.
///
/// if the window may close; otherwise .
public virtual bool CanClose()
{
return true;
}
///
/// Called when the window wants to close, returning will cause the window to stay open.
///
/// A task if the window may close; otherwise .
public virtual Task CanCloseAsync()
{
return Task.FromResult(true);
}
///
/// Occurs when a close was requested
///
public event EventHandler? CloseRequested;
}
}