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-6186: Add option to provide tooltips to message boxes #14500

Merged
merged 16 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 15 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
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 @@ -3765,4 +3765,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>
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
</root>
11 changes: 7 additions & 4 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1534,16 +1534,16 @@ If the toggle is off custom packages that are not already loaded will load once
</data>
<data name="PackageFilterByStatus" xml:space="preserve">
<value>STATUS</value>
</data>
</data>
<data name="PackageFilterNewTooltip" xml:space="preserve">
<value>Published in the last 30 days</value>
</data>
</data>
<data name="PackageFilterUpdatedTooltip" xml:space="preserve">
<value>Updated in the last 30 days</value>
</data>
<data name="PackageFilterDeprecatedTooltip" xml:space="preserve">
<value>Discontinued packages</value>
</data>
</data>
<data name="PackageFilterHasDependenciesTooltip" xml:space="preserve">
<value>Packages that require other packages to be installed</value>
</data>
Expand Down Expand Up @@ -3752,4 +3752,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>
</root>
<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
24 changes: 24 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public MessageBoxImage MessageBoxImage
}
}

public bool ShowTooltip { get; private set; }
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved

public string Tooltip { get; private set; }

#endregion

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

/// <summary>
Expand All @@ -123,6 +129,24 @@ public static MessageBoxResult Show(string messageBoxText, string caption, Messa
return dynamoMessageBox.CustomDialogResult;
}

public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button,
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
MessageBoxImage icon, string tooltip)
{
var dynamoMessageBox = new DynamoMessageBox
{
BodyText = messageBoxText,
TitleText = caption,
MessageBoxButton = button,
MessageBoxImage = icon,
ShowTooltip = !string.IsNullOrEmpty(tooltip),
Tooltip = tooltip
};

dynamoMessageBox.ConfigureButtons(button);
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}


/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
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 @@ -637,7 +637,7 @@ internal void 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
Loading