private void CurrentWorkspaceModel_NodeAdded(NodeModel node) { // When a new node added on canvas, update PropertyPalette var profiledNode = new PropertyPaletteNodeViewModel(node); PropertyPaletteNodes.Add(profiledNode); RaisePropertyChanged(nameof(PropertyPaletteNodesCollection)); }
/// <summary> /// When switching workspaces or closing NodePropertyPalette extension, /// subscribe workspace events for profiling /// </summary> /// <param name="workspace">target workspace</param> private void SubscribeWorkspaceEvents(HomeWorkspaceModel workspace) { workspace.NodeAdded += CurrentWorkspaceModel_NodeAdded; workspace.NodeRemoved += CurrentWorkspaceModel_NodeRemoved; workspace.EvaluationStarted += CurrentWorkspaceModel_EvaluationStarted; workspace.EvaluationCompleted += CurrentWorkspaceModel_EvaluationCompleted; foreach (var node in workspace.Nodes) { var profiledNode = new PropertyPaletteNodeViewModel(node); PropertyPaletteNodes.Add(profiledNode); node.NodeExecutionBegin += OnNodeExecutionBegin; node.NodeExecutionEnd += OnNodeExecutionEnd; } RaisePropertyChanged(nameof(PropertyPaletteNodesCollection)); }