/// <summary> /// Creates a new instance of Dynamo Profiling Session /// </summary> /// <param name="workspace"></param> public Session(IWorkspaceModel workspace) { this.Guid = Guid.NewGuid(); this.Workspace = workspace; this.nodesData = CollectNodeData(workspace); this.RegisterEventHandlers(); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel wsm) { // update the workspace when a new Dynamo file is opened // so that it always references the current workspace WorkspaceModel = wsm; manipulatorNodes = new List <NodeModel>(); }
private void OnCurrentWorkspaceModelChanged(IWorkspaceModel ws) { if (CurrentWorkspaceChanged != null) { CurrentWorkspaceChanged(ws); } }
private void OnCurrentWorkspaceChanged(IWorkspaceModel workspace) { if (!IsIronPythonDialogOpen()) { UnSubscribeWorkspaceEvents(); CurrentWorkspace = workspace as WorkspaceModel; PythonDependencies.UpdateWorkspace(CurrentWorkspace); SubscribeToWorkspaceEvents(); NotificationTracker.Remove(CurrentWorkspace.Guid); GraphPythonDependencies.CustomNodePythonDependencyMap.Clear(); if (Configuration.DebugModes.IsEnabled("Python2ObsoleteMode") && !Models.DynamoModel.IsTestMode && PythonDependencies.CurrentWorkspaceHasIronPythonDependency()) { LogIronPythonNotification(); DisplayIronPythonDialog(); } } CurrentWorkspace.Nodes .Where(x => x is PythonNodeBase) .ToList() .ForEach(x => SubscribeToPythonNodeEvents(x as PythonNodeBase)); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel workspaceModel) { workspaceModel.NodeAdded += OnNodeAdded; workspaceModel.NodeRemoved += OnNodeRemoved; this.ResetCollector(); this.GetAllOnCurrentWindow(); }
private void UnregisterWorkspaceEvents(IWorkspaceModel workspace) { if (workspace is HomeWorkspaceModel homeWorkspace) { homeWorkspace.EvaluationStarted -= this.OnEvaluationStarted; homeWorkspace.EvaluationCompleted -= this.OnEvaluationCompleted; } }
/// <summary> /// Event handler for workspaceRemoved event /// </summary> /// <param name="obj">workspace model</param> internal void OnWorkspaceCleared(IWorkspaceModel obj) { PackageDependencyTable.ItemsSource = null; if (obj is WorkspaceModel) { DependencyRegen(obj as WorkspaceModel); } }
/// <summary> /// Event handler for workspaceRemoved event /// </summary> /// <param name="obj">workspace model</param> internal void OnWorkspaceCleared(IWorkspaceModel obj) { if (obj is WorkspaceModel) { // Clear the dependency table. table.Columns.Clear(); } }
public void Ready(ReadyParams sp) { ReadyParams = sp; sp.CurrentWorkspaceChanged += OnCurrentWorkspaceChanged; (sp.CurrentWorkspaceModel as WorkspaceModel).CollectingCustomNodePackageDependencies += GetCustomNodePackageFromID; (sp.CurrentWorkspaceModel as WorkspaceModel).CollectingNodePackageDependencies += GetNodePackageFromAssemblyName; currentWorkspace = (sp.CurrentWorkspaceModel as WorkspaceModel); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel workspace) { NotificationTracker.Remove(CurrentWorkspace.Guid); CurrentWorkspace = workspace as WorkspaceModel; if (PythonDependencies.ContainsIronPythonDependencies()) { LogIronPythonNotification(); DisplayIronPythonDialog(); } }
private void AddEventHandlers(IWorkspaceModel model) { foreach (var node in model.Nodes) { node.PropertyChanged += node_PropertyChanged; } model.NodeAdded += CurrentWorkspaceModel_NodeAdded; model.NodeRemoved += CurrentWorkspaceModel_NodeRemoved; model.NodesCleared += CurrentWorkspaceModel_NodesCleared; }
public TuneUpWindowViewModel(ViewLoadedParams p) { viewLoadedParams = p; p.CurrentWorkspaceModel.NodeAdded += CurrentWorkspaceModel_NodesChanged; p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged; p.CurrentWorkspaceChanged += OnCurrentWorkspaceChanged; p.CurrentWorkspaceCleared += OnCurrentWorkspaceCleared; currentWorkspace = p.CurrentWorkspaceModel; nodeDictionary = new Dictionary <Guid, ProfiledNodeViewModel>(); numNodesExecuted = 0; }
private void OnCurrentWorkspaceChanged(IWorkspaceModel obj) { if (this.currentWorkspace != null) { UnsubscribeGraphEvents(this.currentWorkspace); } this.linterManager.RuleEvaluationResults.Clear(); this.currentWorkspace = ReadyParamsRef.CurrentWorkspaceModel as WorkspaceModel; this.SubscribeNodeEvents(); this.SubscribeGraphEvents(); this.InitializeRules(); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel wsm) { // update the workspace when a new Dynamo file is opened // so that it always references the current workspace WorkspaceModel = wsm; manipulatorNodes = new List <NodeModel>(); // kill all manipulators in current workspace if (manipulatorDaemon != null) { manipulatorDaemon.KillAll(); } }
private void OnCurrentWorkspaceCleared(IWorkspaceModel workspace) { workspace.NodeAdded -= CurrentWorkspaceModel_NodesChanged; workspace.NodeRemoved -= CurrentWorkspaceModel_NodesChanged; currentWorkspace = null; RaisePropertyChanged(nameof(ProfiledNodes)); foreach (var node in currentWorkspace.Nodes) { node.NodeExecutionBegin -= OnNodeExecutionBegin; node.NodeExecutionEnd -= OnNodeExecutionEnd; } nodeDictionary = new Dictionary <Guid, ProfiledNodeViewModel>(); }
private Session SetCurrentSession(IWorkspaceModel workspace) { if (this.dynamoSession != null) { this.UnregisterWorkspaceEvents(this.dynamoSession.Workspace); this.dynamoSession.Dispose(); } this.dynamoSession = new Session(workspace); this.RegisterWorkspaceEvents(this.dynamoSession.Workspace); this.OnSessionChanged(this.CurrentSession); return(this.dynamoSession); }
private void OnWorkspaceChanged(IWorkspaceModel workspace) { if (this.dynamoSession != null && this.dynamoSession.Workspace.Equals(workspace)) { return; } if (this.dynamoSession != null && !this.dynamoSession.Workspace.Equals(workspace)) { this.dynamoSession.Dispose(); } this.SetCurrentSession(workspace); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel ws) { if (ws is WorkspaceModel) { if (currentWorkspace != null) { (currentWorkspace as WorkspaceModel).CollectingCustomNodePackageDependencies -= GetCustomNodePackageFromID; (currentWorkspace as WorkspaceModel).CollectingNodePackageDependencies -= GetNodePackageFromAssemblyName; } (ws as WorkspaceModel).CollectingCustomNodePackageDependencies += GetCustomNodePackageFromID; (ws as WorkspaceModel).CollectingNodePackageDependencies += GetNodePackageFromAssemblyName; currentWorkspace = ws; } }
/// <summary> /// Event handler for workspaceAdded event /// </summary> /// <param name="obj">workspace model</param> internal void OnWorkspaceChanged(IWorkspaceModel obj) { if (obj is WorkspaceModel) { // Unsubscribe if (currentWorkspace != null) { currentWorkspace.PropertyChanged -= OnWorkspacePropertyChanged; } DependencyRegen(obj as WorkspaceModel); // Update current workspace currentWorkspace = obj as WorkspaceModel; currentWorkspace.PropertyChanged += OnWorkspacePropertyChanged; } }
/// <summary> /// Sets the workspace model property and updates event handlers accordingly. /// </summary> /// <param name="wsm">Workspace Model to set</param> private void SetWorkSpaceModel(IWorkspaceModel wsm) { var settings = GetRunSettings(workspaceModel); if (settings != null) { //Remove RunSettings event handler from old run settings. settings.PropertyChanged -= OnRunSettingsPropertyChanged; } workspaceModel = wsm; settings = GetRunSettings(wsm); if (settings != null) { //Register RunSettings event handler settings.PropertyChanged += OnRunSettingsPropertyChanged; } }
private void OnCurrentWorkspaceChanged(IWorkspaceModel obj) { HomeWorkspaceModel incomingWorkspace = obj as HomeWorkspaceModel; //If incoming workspace is not of expected type we will unlink from current workspace. //This will happen when you edit a custom node for example. //Other than that we do not expect to have a change event for the same workspace, //we assume something went bad in this case and we also unlink. //If the incoming workspace is default home screen workspace we also unlink. if (incomingWorkspace is null || currentWorkspace == incomingWorkspace || String.IsNullOrEmpty(incomingWorkspace.FileName)) { UnlinkFromCurrentWorkspace(); return; } LinkToWorkspace(incomingWorkspace); }
private void OnCurrentWorkspaceClosing(IWorkspaceModel obj) { HomeWorkspaceModel workspaceAboutToClose = obj as HomeWorkspaceModel; //It can be a CustomNodeWorkspaceModel which we are not interested in processing if (workspaceAboutToClose is null) { return; } //we only care about the workspace we are linked to if (workspaceAboutToClose != currentWorkspace) { return; } foreach (var rule in linterRules) { rule?.CleanupRule(workspaceAboutToClose); } UnlinkFromCurrentWorkspace(); }
internal GraphPythonDependencies(IWorkspaceModel workspaceModel, ICustomNodeManager customNodeManager) { this.workspace = workspaceModel; this.customNodeManager = customNodeManager; }
private void OnCurrentWorkspaceModelChanged(IWorkspaceModel ws) { if (CurrentWorkspaceChanged != null) CurrentWorkspaceChanged(ws); }
/// <summary> /// Get RunSettings object for a given Workspace Model. /// </summary> /// <param name="wsm">IWorkspaceModel object</param> /// <returns>RunSettings</returns> private RunSettings GetRunSettings(IWorkspaceModel wsm) { var homeWSM = wsm as HomeWorkspaceModel; return homeWSM == null ? null : homeWSM.RunSettings; }
private void OnCurrentWorkspaceChanged(IWorkspaceModel wsm) { // update the workspace when a new Dynamo file is opened // so that it always references the current workspace WorkspaceModel = wsm; manipulatorNodes = new List<NodeModel>(); // kill all manipulators in current workspace if (manipulatorDaemon != null) { manipulatorDaemon.KillAll(); } }
/// <summary> /// Returns RunSettings object for a given Workspace Model. /// </summary> /// <param name="wsm">IWorkspaceModel object</param> /// <returns>RunSettings</returns> private RunSettings GetRunSettings(IWorkspaceModel wsm) { var homeWSM = wsm as HomeWorkspaceModel; return(homeWSM == null ? null : homeWSM.RunSettings); }
private void OnCurrentWorkspaceChanged(IWorkspaceModel workspace) { CurrentWorkspace = workspace as HomeWorkspaceModel; }
private void CurrentWorkspaceChanged(IWorkspaceModel ws) { var isEnabled = ws is HomeWorkspaceModel && startupParams.AuthProvider != null; extensionMenuItem.IsEnabled = isEnabled; }
private static Dictionary <Guid, NodeProfilingData> CollectNodeData(IWorkspaceModel workspace) { return(workspace.Nodes .ToDictionary(node => node.GUID, node => new NodeProfilingData(node))); }
internal void UpdateWorkspace(IWorkspaceModel workspaceModel) { this.workspace = workspaceModel; }
private void OnCurrentWorkspaceChanged(IWorkspaceModel wsm) { // update the workspace when a new Dynamo file is opened // so that it always references the current workspace WorkspaceModel = wsm; manipulatorNodes = new List<NodeModel>(); }
private void POnCurrentWorkspaceChanged(IWorkspaceModel obj) { obj.NodeAdded -= CurrentWorkspaceModelOnNodeAdded; obj.NodeAdded += CurrentWorkspaceModelOnNodeAdded; }
private void OnCurrentWorkspaceCleared(IWorkspaceModel workspace) { CurrentWorkspace = viewLoadedParams.CurrentWorkspaceModel as HomeWorkspaceModel; }