From 3d0fe0ce9601ae5321858c1ef7fa692766c00a62 Mon Sep 17 00:00:00 2001 From: aparajit-pratap Date: Fri, 20 Oct 2023 09:43:00 -0400 Subject: [PATCH] cherry pick PRs 14424, 14500 --- .../Properties/Resources.Designer.cs | 11 ++++++- .../Properties/Resources.en-US.resx | 3 ++ src/DynamoCoreWpf/Properties/Resources.resx | 3 ++ .../UI/Prompts/DynamoMessageBox.xaml | 30 +++++++++++++++++++ .../UI/Prompts/DynamoMessageBox.xaml.cs | 21 +++++++++++-- .../ViewModels/Core/WorkspaceViewModel.cs | 2 +- 6 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index 1ea43e5cc5b..54ba4ec8cfc 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -2684,7 +2684,16 @@ public static string EditWindowTitle { } /// - /// Looks up a localized string similar to A Save As command will create a workspace which is treated as a completely new file by Dynamo and existing element binding data will be lost. New element binding data will created as normal as you run this file. Use the Save command instead if you wish to preserve element binding with the host document.. + /// Looks up a localized string similar to Element Binding allows a two-way interaction between Dynamo and the host application like Revit or Civil3D where a user can select an element in the host document and have Dynamo "bind" that element to a node in the workspace.. + /// + public static string ElementBindingDesc { + get { + return ResourceManager.GetString("ElementBindingDesc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A Save As command will create a workspace which is treated as a completely new file by Dynamo and existing element binding data will be lost. New element binding data will be created as normal as you run this file. Use the Save command instead if you wish to preserve element binding with the host document.. /// public static string ElementBindingWarningMessage { get { diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index c379b979500..b6b9a256805 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -3657,4 +3657,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Element Binding Warning + + Element Binding allows a two-way interaction between Dynamo and the host application like Revit or Civil3D where a user can select an element in the host document and have Dynamo "bind" that element to a node in the workspace. + diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 116f3ceefda..20166f73c35 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -3644,4 +3644,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Element Binding Warning + + Element Binding allows a two-way interaction between Dynamo and the host application like Revit or Civil3D where a user can select an element in the host document and have Dynamo "bind" that element to a node in the workspace. + diff --git a/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml b/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml index 3bce7cdcf4d..4ef3bde4065 100644 --- a/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml +++ b/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml @@ -5,6 +5,7 @@ xmlns:ui="clr-namespace:Dynamo.UI" xmlns:localui="clr-namespace:Dynamo.Wpf.UI.GuidedTour" xmlns:w="clr-namespace:System.Windows;assembly=PresentationCore" + xmlns:fa5="http://schemas.fontawesome.com/icons/" Title="{x:Static p:Resources.GenericTaskDialogTitle}" MinWidth="400" MaxWidth="500" @@ -98,6 +99,35 @@ Foreground="#3C3C3C" Text="{Binding TitleText, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" /> + + /// A tooltip is shown on the message box when this is set to true and if + /// Tooltip is non-null and non-empty. + /// + public bool ShowTooltip { get; private set; } + + /// + /// A tooltip is shown on the message box when this is set to a non-empty string + /// and ShowTooltip is true. + /// + public string Tooltip { get; private set; } + #endregion /// @@ -97,6 +109,8 @@ public DynamoMessageBox() { InitializeComponent(); DataContext = this; + ShowTooltip = false; + ToolTip = ""; } /// @@ -106,16 +120,19 @@ public DynamoMessageBox() /// /// /// + /// /// public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, - MessageBoxImage icon) + MessageBoxImage icon, string tooltip = "") { var dynamoMessageBox = new DynamoMessageBox { BodyText = messageBoxText, TitleText = caption, MessageBoxButton = button, - MessageBoxImage = icon + MessageBoxImage = icon, + ShowTooltip = !string.IsNullOrEmpty(tooltip), + Tooltip = tooltip }; dynamoMessageBox.ConfigureButtons(button); diff --git a/src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs index 522f27678e6..2d95e6378ec 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs @@ -636,7 +636,7 @@ internal bool Save(string filePath, bool isBackup = false, EngineController engi { var result = DynamoMessageBox.Show(Wpf.Properties.Resources.ElementBindingWarningMessage, Wpf.Properties.Resources.ElementBindingWarningTitle, MessageBoxButton.OKCancel, - MessageBoxImage.Warning); + MessageBoxImage.Warning, Wpf.Properties.Resources.ElementBindingDesc); if (result == MessageBoxResult.Cancel) {