private async Task SwitchFunctionEditor(VisualScriptMethodViewModel previousMethod, VisualScriptMethodViewModel newMethod) { // Make sure the previous switch is finished if (lastSwitchFunctionEditor != null) { await lastSwitchFunctionEditor; } if (previousMethod != null) { previousMethod.Destroy(); // Unbind old function VisibleMethod = null; } if (newMethod != null) { var functionEditor = new VisualScriptMethodEditorViewModel(this, newMethod); await functionEditor.Initialize(); // Bind new function VisibleMethod = functionEditor; } }
public VisualScriptMethodEditorViewModel(VisualScriptEditorViewModel editor, VisualScriptMethodViewModel method) : base(editor.SafeArgument(nameof(editor)).ServiceProvider) { this.editor = editor; this.method = method; var methodNode = editor.Session.AssetNodeContainer.GetNode(method.Method); blocksNode = methodNode[nameof(method.Method.Blocks)].Target; linksNode = methodNode[nameof(method.Method.Links)].Target; parametersNode = methodNode[nameof(method.Method.Parameters)].Target; }