Skip to content

Commit

Permalink
cherry pick PRs 14424, 14500
Browse files Browse the repository at this point in the history
  • Loading branch information
aparajit-pratap committed Mar 19, 2024
1 parent c6df6e6 commit 3d0fe0c
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3657,4 +3657,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="ElementBindingWarningTitle" xml:space="preserve">
<value>Element Binding Warning</value>
</data>
<data name="ElementBindingDesc" xml:space="preserve">
<value>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.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3644,4 +3644,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="ElementBindingWarningTitle" xml:space="preserve">
<value>Element Binding Warning</value>
</data>
<data name="ElementBindingDesc" xml:space="preserve">
<value>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.</value>
</data>
</root>
30 changes: 30 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -98,6 +99,35 @@
Foreground="#3C3C3C"
Text="{Binding TitleText, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label HorizontalAlignment="Right"
Name="TooltipInfo"
VerticalAlignment="Center"
Height="26"
Width="53"
Margin="20 -3 0 0">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding ShowTooltip}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
<Label.ToolTip>
<ToolTip Content="{Binding Path=Tooltip}"
Style="{StaticResource GenericToolTipLight}"/>
</Label.ToolTip>
<Label.Content>
<fa5:ImageAwesome Width="15"
Height="15"
VerticalAlignment="Bottom"
HorizontalAlignment="Left"
Icon="Solid_QuestionCircle"
Foreground="#808080"/>
</Label.Content>
</Label>
</DockPanel>
<Rectangle Name="Separator"
Grid.Row="0"
Expand Down
21 changes: 19 additions & 2 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ public MessageBoxImage MessageBoxImage
}
}

/// <summary>
/// A tooltip is shown on the message box when this is set to true and if
/// Tooltip is non-null and non-empty.
/// </summary>
public bool ShowTooltip { get; private set; }

/// <summary>
/// A tooltip is shown on the message box when this is set to a non-empty string
/// and ShowTooltip is true.
/// </summary>
public string Tooltip { get; private set; }

#endregion

/// <summary>
Expand All @@ -97,6 +109,8 @@ public DynamoMessageBox()
{
InitializeComponent();
DataContext = this;
ShowTooltip = false;
ToolTip = "";
}

/// <summary>
Expand All @@ -106,16 +120,19 @@ public DynamoMessageBox()
/// <param name="caption"></param>
/// <param name="button"></param>
/// <param name="icon"></param>
/// <param name="tooltip"></param>
/// <returns></returns>
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);
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 3d0fe0c

Please sign in to comment.