using Artemis.Core.ScriptingProviders; namespace Artemis.UI.Shared.ScriptingProviders; /// /// Represents a Stylet view model containing a script editor /// public class ScriptEditorViewModel : ActivatableViewModelBase, IScriptEditorViewModel { private Script? _script; /// /// Creates a new instance of /// /// The script type this view model was created for public ScriptEditorViewModel(ScriptType scriptType) { ScriptType = scriptType; } /// /// Called just before the script is changed to a different one /// /// The script to display or if no script is to be displayed protected virtual void OnScriptChanging(Script? script) { } /// /// Called after the script was changed to a different one /// /// The script to display or if no script is to be displayed protected virtual void OnScriptChanged(Script? script) { } /// public ScriptType ScriptType { get; } /// public Script? Script { get => _script; internal set => RaiseAndSetIfChanged(ref _script, value); } /// public void ChangeScript(Script? script) { OnScriptChanging(script); Script = script; OnScriptChanged(script); } }