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

port remove fix #14438

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions src/DynamoCoreWpf/Controls/DynamoNodeButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Dynamo.Controls;
using Dynamo.Graph;
using Dynamo.Models;
using Dynamo.UI;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Wpf.Utilities;
Expand Down Expand Up @@ -67,23 +66,28 @@ private void OnDynamoNodeButtonClick(object sender, RoutedEventArgs e)
//
if (null != this.model && (!string.IsNullOrEmpty(this.eventName)))
{
MessageBoxResult result = MessageBoxResult.None;
// Only show the prompt if it is a Python node
var nodeVM = (sender as DynamoNodeButton)?.DataContext as NodeViewModel;
if (nodeVM?.NodeModel is PythonNodeModels.PythonNode)
{
MessageBoxResult result = MessageBoxResult.None;

if (eventName.Equals("RemoveInPort") && ShowWarningForRemovingInPort)
{
result = MessageBoxService.Show
(
Owner,
Dynamo.Wpf.Properties.Resources.MessageRemovePythonPort,
Dynamo.Wpf.Properties.Resources.RemovePythonPortWarningMessageBoxTitle,
MessageBoxButton.OKCancel,
MessageBoxImage.Information
);
}
if (eventName.Equals("RemoveInPort") && ShowWarningForRemovingInPort)
{
result = MessageBoxService.Show
(
Owner,
Dynamo.Wpf.Properties.Resources.MessageRemovePythonPort,
Dynamo.Wpf.Properties.Resources.RemovePythonPortWarningMessageBoxTitle,
MessageBoxButton.OKCancel,
MessageBoxImage.Information
);
}

if (result == MessageBoxResult.Cancel)
{
return;
if (result == MessageBoxResult.Cancel)
{
return;
}
}

var command = new DynamoModel.ModelEventCommand(model.GUID, eventName);
Expand Down