Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-7117 Node Cluster Placement and Performance SPIKE #15384

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/Commands/PortCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.UI.Commands;
using Dynamo.UI.Commands;

namespace Dynamo.ViewModels
{
Expand Down Expand Up @@ -32,7 +32,7 @@ public DelegateCommand NodeAutoCompleteCommand
get
{
if (autoCompleteCommand == null)
autoCompleteCommand = new DelegateCommand(AutoComplete, CanAutoComplete);
autoCompleteCommand = new DelegateCommand(AutoCompleteCluster, CanAutoComplete);

return autoCompleteCommand;
}
Expand Down
27 changes: 26 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Core/PortViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Dynamo.Graph.Nodes;
using Dynamo.Models;
using Dynamo.UI.Commands;
using Dynamo.Utilities;

Expand Down Expand Up @@ -416,6 +417,30 @@ private void AutoComplete(object parameter)
wsViewModel.OnRequestNodeAutoCompleteSearch(ShowHideFlags.Show);
}

// Handler to invoke Node AutoComplete cluster placement as a test
private void AutoCompleteCluster(object parameter)
{
// Put a C# timer here to test the cluster placement
Stopwatch stopwatch = Stopwatch.StartNew();

var wsViewModel = node.WorkspaceViewModel;
wsViewModel.NodeAutoCompleteSearchViewModel.PortViewModel = this;

// If the input port is disconnected by the 'Connect' command while triggering Node AutoComplete, undo the port disconnection.
if (this.inputPortDisconnectedByConnectCommand)
{
wsViewModel.DynamoViewModel.Model.CurrentWorkspace.Undo();
}

// Bail out from connect state
wsViewModel.CancelActiveState();
wsViewModel.NodeAutoCompleteSearchViewModel.DefaultResults.LastOrDefault().CreateAndConnectCommand.Execute(wsViewModel.NodeAutoCompleteSearchViewModel.PortViewModel.PortModel);
wsViewModel.Nodes.LastOrDefault().IsFrozen = true;

stopwatch.Stop(); // Stop the stopwatch
wsViewModel.DynamoViewModel.Model.Logger.Log($"Execution Time: {stopwatch.ElapsedMilliseconds} ms");
}

private void NodePortContextMenu(object obj)
{
// If this port does not display a Chevron button to open the context menu and it doesn't
Expand Down
Loading