Meta - Replace WPF projects with Avalonia projects

This commit is contained in:
Robert committed 2022-03-27 11:55:26 +02:00
1 parent fcf0376a9a
commit d7f3ee1190
1110 files changed
+10872 -52240

No files matched your search

@@ -1,12 +1,13 @@
using Artemis.Core.LayerBrushes;
using Stylet;
using System;
using System.Threading.Tasks;
using Artemis.Core.LayerBrushes;
namespace Artemis.UI.Shared.LayerBrushes
{
/// <summary>
/// Represents a view model for a brush configuration window
/// </summary>
public abstract class BrushConfigurationViewModel : Screen
public abstract class BrushConfigurationViewModel : ActivatableViewModelBase
{
/// <summary>
/// Creates a new instance of the <see cref="BrushConfigurationViewModel" /> class
@@ -17,19 +18,40 @@ namespace Artemis.UI.Shared.LayerBrushes
LayerBrush = layerBrush;
}
/// <summary>
/// Creates a new instance of the <see cref="BrushConfigurationViewModel" /> class with a validator
/// </summary>
/// <param name="layerBrush"></param>
/// <param name="validator"></param>
protected BrushConfigurationViewModel(BaseLayerBrush layerBrush, IModelValidator validator) : base(validator)
{
LayerBrush = layerBrush;
}
/// <summary>
/// Gets the layer brush this view model is associated with
/// </summary>
public BaseLayerBrush LayerBrush { get; }
/// <summary>
/// Closes the dialog
/// </summary>
public void RequestClose()
{
CloseRequested?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// Called when the window wants to close, returning <see langword="false" /> will cause the window to stay open.
/// </summary>
/// <returns><see langword="true" /> if the window may close; otherwise <see langword="false" />.</returns>
public virtual bool CanClose()
{
return true;
}
/// <summary>
/// Called when the window wants to close, returning <see langword="false" /> will cause the window to stay open.
/// </summary>
/// <returns>A task <see langword="true" /> if the window may close; otherwise <see langword="false" />.</returns>
public virtual Task<bool> CanCloseAsync()
{
return Task.FromResult(true);
}
/// <summary>
/// Occurs when a close was requested
/// </summary>
public event EventHandler? CloseRequested;
}
}
@@ -38,7 +38,7 @@ namespace Artemis.UI.Shared.LayerBrushes
public int DialogHeight { get; set; } = 800;
/// <summary>
/// The type of view model the tab contains
/// The type of view model the dialog contains
/// </summary>
public abstract Type Type { get; }
}
@@ -1,35 +1,57 @@
using Artemis.Core.LayerEffects;
using Stylet;
using System;
using System.Threading.Tasks;
using Artemis.Core.LayerEffects;
using Avalonia.Threading;
namespace Artemis.UI.Shared.LayerEffects
namespace Artemis.UI.Shared.LayerEffects;
/// <summary>
/// Represents a view model for an effect configuration window
/// </summary>
public abstract class EffectConfigurationViewModel : ActivatableViewModelBase
{
/// <summary>
/// Represents a view model for an effect configuration window
/// Creates a new instance of the <see cref="EffectConfigurationViewModel" /> class
/// </summary>
public abstract class EffectConfigurationViewModel : Screen
/// <param name="layerEffect"></param>
protected EffectConfigurationViewModel(BaseLayerEffect layerEffect)
{
/// <summary>
/// Creates a new instance of the <see cref="EffectConfigurationViewModel" /> class
/// </summary>
/// <param name="layerEffect"></param>
protected EffectConfigurationViewModel(BaseLayerEffect layerEffect)
{
LayerEffect = layerEffect;
}
/// <summary>
/// Creates a new instance of the <see cref="EffectConfigurationViewModel" /> class with a validator
/// </summary>
/// <param name="layerEffect"></param>
/// <param name="validator"></param>
protected EffectConfigurationViewModel(BaseLayerEffect layerEffect, IModelValidator validator) : base(validator)
{
LayerEffect = layerEffect;
}
/// <summary>
/// Gets the layer effect this view model is associated with
/// </summary>
public BaseLayerEffect LayerEffect { get; }
LayerEffect = layerEffect;
}
/// <summary>
/// Gets the layer effect this view model is associated with
/// </summary>
public BaseLayerEffect LayerEffect { get; }
/// <summary>
/// Closes the dialog
/// </summary>
public void RequestClose()
{
CloseRequested?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// Called when the window wants to close, returning <see langword="false" /> will cause the window to stay open.
/// </summary>
/// <returns><see langword="true" /> if the window may close; otherwise <see langword="false" />.</returns>
public virtual bool CanClose()
{
return true;
}
/// <summary>
/// Called when the window wants to close, returning <see langword="false" /> will cause the window to stay open.
/// </summary>
/// <returns>A task <see langword="true" /> if the window may close; otherwise <see langword="false" />.</returns>
public virtual Task<bool> CanCloseAsync()
{
return Task.FromResult(true);
}
/// <summary>
/// Occurs when a close was requested
/// </summary>
public event EventHandler? CloseRequested;
}
@@ -39,7 +39,7 @@ namespace Artemis.UI.Shared.LayerEffects
public int DialogHeight { get; set; } = 800;
/// <summary>
/// The type of view model the tab contains
/// The type of view model the dialog contains
/// </summary>
public abstract Type Type { get; }
}
@@ -1,27 +0,0 @@
using Artemis.Core.Modules;
using Stylet;
namespace Artemis.UI.Shared.Modules
{
/// <summary>
/// The base class for any view model that belongs to a module
/// </summary>
public abstract class ModuleViewModel : Screen, IModuleViewModel
{
/// <summary>
/// The base class for any view model that belongs to a module
/// </summary>
/// <param name="module">The module this view model belongs to</param>
/// <param name="displayName">The name of the tab that's shown on the modules UI page</param>
protected ModuleViewModel(Module module, string displayName)
{
Module = module;
DisplayName = displayName.ToUpper();
}
/// <summary>
/// Gets the module this view model belongs to
/// </summary>
public Module Module { get; }
}
}
@@ -15,9 +15,7 @@ namespace Artemis.UI.Shared
/// </summary>
public abstract class PluginConfigurationDialog : IPluginConfigurationDialog
{
/// <summary>
/// The type of view model the tab contains
/// </summary>
/// <inheritdoc />
public abstract Type Type { get; }
}
}
@@ -1,12 +1,12 @@
using Artemis.Core;
using Stylet;
using System;
using Artemis.Core;
namespace Artemis.UI.Shared
{
/// <summary>
/// Represents a view model for a plugin configuration window
/// </summary>
public abstract class PluginConfigurationViewModel : Screen, IPluginConfigurationViewModel
public abstract class PluginConfigurationViewModel : ViewModelValidationBase, IPluginConfigurationViewModel
{
/// <summary>
/// Creates a new instance of the <see cref="PluginConfigurationViewModel" /> class
@@ -17,19 +17,30 @@ namespace Artemis.UI.Shared
Plugin = plugin;
}
/// <summary>
/// Creates a new instance of the <see cref="PluginConfigurationViewModel" /> class with a validator
/// </summary>
/// <param name="plugin"></param>
/// <param name="validator"></param>
protected PluginConfigurationViewModel(Plugin plugin, IModelValidator validator) : base(validator)
{
Plugin = plugin;
}
/// <summary>
/// Gets the plugin this configuration view model is associated with
/// </summary>
public Plugin Plugin { get; }
/// <summary>
/// Closes the window hosting the view model
/// </summary>
public void Close()
{
CloseRequested?.Invoke(this, EventArgs.Empty);
OnCloseRequested();
}
/// <summary>
/// Called when the the window hosting the view model should close
/// </summary>
public virtual void OnCloseRequested()
{
}
/// <summary>
/// Occurs when the the window hosting the view model should close
/// </summary>
public event EventHandler? CloseRequested;
}
}
@@ -1,12 +1,12 @@
using Artemis.Core.ScriptingProviders;
using Stylet;
using ReactiveUI;
namespace Artemis.UI.Shared.ScriptingProviders
{
/// <summary>
/// Represents a Stylet view model containing a script editor
/// </summary>
public class ScriptEditorViewModel : Screen, IScriptEditorViewModel
public class ScriptEditorViewModel : ActivatableViewModelBase, IScriptEditorViewModel
{
private Script? _script;
@@ -42,7 +42,7 @@ namespace Artemis.UI.Shared.ScriptingProviders
public Script? Script
{
get => _script;
internal set => SetAndNotify(ref _script, value);
internal set => RaiseAndSetIfChanged(ref _script, value);
}
/// <inheritdoc />