diff --git a/src/DynamoCoreWpf/Controls/DynamoNodeButton.cs b/src/DynamoCoreWpf/Controls/DynamoNodeButton.cs index a0e0f49c675..3b2b4dc6fc5 100644 --- a/src/DynamoCoreWpf/Controls/DynamoNodeButton.cs +++ b/src/DynamoCoreWpf/Controls/DynamoNodeButton.cs @@ -7,6 +7,7 @@ using Dynamo.UI; using Dynamo.Utilities; using Dynamo.ViewModels; +using Dynamo.Wpf.Utilities; namespace Dynamo.Nodes { @@ -28,6 +29,17 @@ private DynamoViewModel DynamoViewModel } } + private Window Owner + { + get + { + var f = WpfUtilities.FindUpVisualTree(this); + if (f != null) return f; + + return null; + } + } + public DynamoNodeButton() { } @@ -49,9 +61,28 @@ private void OnDynamoNodeButtonClick(object sender, RoutedEventArgs e) // if (null != this.model && (!string.IsNullOrEmpty(this.eventName))) { + MessageBoxResult result = MessageBoxResult.None; + + if (eventName.Equals("RemoveInPort")) + { + result = MessageBoxService.Show + ( + Owner, + Dynamo.Wpf.Properties.Resources.MessageRemovePythonPort, + Dynamo.Wpf.Properties.Resources.RemovePythonPortWarningMessageBoxTitle, + MessageBoxButton.OKCancel, + MessageBoxImage.Information + ); + } + + if (result == MessageBoxResult.Cancel) + { + return; + } + var command = new DynamoModel.ModelEventCommand(model.GUID, eventName); this.DynamoViewModel.ExecuteCommand(command); } } } -} \ No newline at end of file +} diff --git a/src/DynamoCoreWpf/Controls/InPortContextMenu.xaml b/src/DynamoCoreWpf/Controls/InPortContextMenu.xaml index bac80c11faf..155c90a7f67 100644 --- a/src/DynamoCoreWpf/Controls/InPortContextMenu.xaml +++ b/src/DynamoCoreWpf/Controls/InPortContextMenu.xaml @@ -1,4 +1,4 @@ - + IsChecked="{Binding Path=UseLevels, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" + Visibility="{Binding IsPythonNodePort, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}" /> + IsEnabled="{Binding ElementName=UseLevel, Path=IsChecked}" + Visibility="{Binding IsPythonNodePort, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}" /> + + +