Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit committed May 17, 2024
1 parent cccc589 commit 71c3210
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 6 deletions.
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

8 changes: 7 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ Don't worry, you'll have the option to save your work.</value>
<value>_Select All</value>
<comment>Edit menu | Select all nodes</comment>
</data>
<data name="DynamoViewEditMenuUnpinAllPreviewBubbles" xml:space="preserve">
<data name="DynamoViewEditMenuUnpinAllPreviewBubbles" xml:space="preserve">
<value>_Unpin All Preview Bubbles</value>
<comment>Edit menu | Unpin preview bubbles</comment>
</data>
Expand Down Expand Up @@ -3975,4 +3975,10 @@ To make this file into a new template, save it to a different folder, then move
<data name="MessagePackOlderDynamoLink" xml:space="preserve">
<value>#Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8</value>
</data>
<data name="DuplicateFilesInPublishWarningMessage" xml:space="preserve">
<value>Files with same name will be overwritten in the final package. To avoid this, rename or discard the duplicate files, or enable the Retain Folder Structure option.\n\n{0} duplicate file(s) found:\n{1}</value>
</data>
<data name="DuplicateFilesInPublishWarningTitle" xml:space="preserve">
<value>Duplicate Files</value>
</data>
</root>
8 changes: 7 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
<value>_Select All</value>
<comment>Edit menu | Select all nodes</comment>
</data>
<data name="DynamoViewEditMenuUnpinAllPreviewBubbles" xml:space="preserve">
<data name="DynamoViewEditMenuUnpinAllPreviewBubbles" xml:space="preserve">
<value>_Unpin All Preview Bubbles</value>
<comment>Edit menu | Unpin preview bubbles</comment>
</data>
Expand Down Expand Up @@ -3962,4 +3962,10 @@ To make this file into a new template, save it to a different folder, then move
<data name="MessagePackOlderDynamoLink" xml:space="preserve">
<value>#Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8</value>
</data>
<data name="DuplicateFilesInPublishWarningMessage" xml:space="preserve">
<value>Files with same name will be overwritten in the final package. To avoid this, rename or discard the duplicate files, or enable the Retain Folder Structure option.\n\n{0} duplicate file(s) found:\n{1}</value>
</data>
<data name="DuplicateFilesInPublishWarningTitle" xml:space="preserve">
<value>Duplicate Files</value>
</data>
</root>
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,8 @@ Dynamo.UI.IViewModelView<T>.ViewModel.get -> T
Dynamo.UI.Prompts.DynamoMessageBox
Dynamo.UI.Prompts.DynamoMessageBox.BodyText.get -> string
Dynamo.UI.Prompts.DynamoMessageBox.BodyText.set -> void
Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags
Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags.Scrollable = 0 -> Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags
Dynamo.UI.Prompts.DynamoMessageBox.DialogResult.get -> bool?
Dynamo.UI.Prompts.DynamoMessageBox.DialogResult.set -> void
Dynamo.UI.Prompts.DynamoMessageBox.DynamoMessageBox() -> void
Expand Down Expand Up @@ -4287,6 +4289,7 @@ static Dynamo.UI.Prompts.DynamoMessageBox.Show(string messageBoxText, string cap
static Dynamo.UI.Prompts.DynamoMessageBox.Show(string messageBoxText, string caption, System.Windows.MessageBoxButton button) -> System.Windows.MessageBoxResult
static Dynamo.UI.Prompts.DynamoMessageBox.Show(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, string tooltip = "") -> System.Windows.MessageBoxResult
static Dynamo.UI.Prompts.DynamoMessageBox.Show(System.Windows.Window owner, string messageBoxText, string caption, bool showRichTextBox, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon) -> System.Windows.MessageBoxResult
static Dynamo.UI.Prompts.DynamoMessageBox.Show(System.Windows.Window owner, string messageBoxText, string caption, System.Collections.Generic.Dictionary<Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags, bool> flags, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon) -> System.Windows.MessageBoxResult
static Dynamo.UI.Prompts.DynamoMessageBox.Show(System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon) -> System.Windows.MessageBoxResult
static Dynamo.UI.SharedDictionaryManager.ConnectorsDictionary.get -> System.Windows.ResourceDictionary
static Dynamo.UI.SharedDictionaryManager.ConnectorsDictionaryUri.get -> System.Uri
Expand Down Expand Up @@ -5498,6 +5501,7 @@ static Dynamo.Wpf.Utilities.MessageBoxService.Show(string msg, string title, boo
static Dynamo.Wpf.Utilities.MessageBoxService.Show(string msg, string title, System.Windows.MessageBoxButton button, System.Collections.Generic.IEnumerable<string> buttonNames, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.MessageBoxService.Show(string msg, string title, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.MessageBoxService.Show(System.Windows.Window owner, string msg, string title, bool showRichTextBox, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.MessageBoxService.Show(System.Windows.Window owner, string msg, string title, System.Collections.Generic.Dictionary<Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags, bool> flags, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.MessageBoxService.Show(System.Windows.Window owner, string msg, string title, System.Windows.MessageBoxButton button, System.Collections.Generic.IEnumerable<string> buttonNames, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.MessageBoxService.Show(System.Windows.Window owner, string msg, string title, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
static Dynamo.Wpf.Utilities.WebView2Utilities.ValidateWebView2RuntimeInstalled() -> bool
Expand Down
16 changes: 14 additions & 2 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,27 @@

<!-- Body Text -->
<TextBlock Name="BodyTextBlock"
Grid.Row="1"
Margin="20"
Margin="20"
VerticalAlignment="Center"
DockPanel.Dock="Left"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="14px"
Foreground="#3C3C3C"
Text="{Binding BodyText, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<!-- Body text in scrollable text box -->
<ScrollViewer Name="ScrollableBodyTextBlock" VerticalScrollBarVisibility="Auto"
Margin="20" MaxHeight="250" Grid.Row="1" Visibility="Collapsed">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="14px"
Foreground="#3C3C3C"
Text="{Binding BodyText, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
</ScrollViewer>
<!-- Body text in custom rich text box, mostly used in guided tours -->
<localui:CustomRichTextBox x:Name="ContentRichTextBox"
IsDocumentEnabled="True"
Visibility="Collapsed"
Expand Down
45 changes: 45 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ public MessageBoxImage MessageBoxImage
/// </summary>
public string Tooltip { get; private set; }

/// <summary>
/// A list of customization options for dialog box
/// </summary>
public enum DialogFlags
{
//Enables scrollable text in the message box
Scrollable = 0,
}

#endregion

/// <summary>
Expand Down Expand Up @@ -204,6 +213,7 @@ public static MessageBoxResult Show(Window owner, string messageBoxText, string
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
Expand Down Expand Up @@ -234,6 +244,41 @@ public static MessageBoxResult Show(Window owner,string messageBoxText, string c
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
/// <param name="owner">owning window of the messagebox</param>
/// <param name="messageBoxText">Content of the message</param>
/// <param name="caption">MessageBox title</param>
/// <param name="flags">Provide a list of flags that can be used to customize the dialog box, e.g Scrollable</param>
/// <param name="button">Type of button shown in the MessageBox: Ok, OkCancel; etc</param>
/// <param name="icon">Type of message: Warning, Error</param>
/// <returns></returns>
public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, Dictionary<DialogFlags, bool> flags, MessageBoxButton button,
MessageBoxImage icon)
{
var dynamoMessageBox = new DynamoMessageBox
{
BodyText = messageBoxText,
TitleText = caption,
MessageBoxButton = button,
MessageBoxImage = icon
};
if (owner != null && owner.IsLoaded)
{
dynamoMessageBox.Owner = owner;
}

if (flags.TryGetValue(DialogFlags.Scrollable, out bool scrollable) && scrollable)
{
dynamoMessageBox.BodyTextBlock.Visibility = Visibility.Collapsed;
dynamoMessageBox.ScrollableBodyTextBlock.Visibility = Visibility.Visible;
}
dynamoMessageBox.ConfigureButtons(button);
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal interface IMessageBox
MessageBoxResult Show(string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner, string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner, string msg, string title, Dictionary<DynamoMessageBox.DialogFlags, bool> flags, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img);
MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img);
Expand All @@ -34,6 +35,10 @@ MessageBoxResult IMessageBox.Show(Window owner, string msg, string title, bool s
{
return DynamoMessageBox.Show(owner,msg, title, showRichTextBox, button, img);
}
MessageBoxResult IMessageBox.Show(Window owner, string msg, string title, Dictionary<DynamoMessageBox.DialogFlags, bool> flags, MessageBoxButton button, MessageBoxImage img)
{
return DynamoMessageBox.Show(owner, msg, title, flags, button, img);
}

public MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, MessageBoxImage img)
{
Expand Down Expand Up @@ -68,6 +73,10 @@ public static MessageBoxResult Show(Window owner, string msg, string title, bool
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner,msg, title, showRichTextBox, button, img);
}
public static MessageBoxResult Show(Window owner, string msg, string title, Dictionary<DynamoMessageBox.DialogFlags, bool> flags, MessageBoxButton button, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner, msg, title, flags, button, img);
}
public static MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner,msg, title, button, img);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2655,11 +2655,12 @@ private void PreviewPackageBuild()
var duplicateFiles = files.GroupBy(x => Path.GetFileName(x))
.Where(x => x.Count() > 1)
.ToList();
if (duplicateFiles.Count() > 0)
if (duplicateFiles.Count > 0)
{
if (!DynamoModel.IsTestMode)
{
MessageBoxService.Show(System.Windows.Application.Current?.MainWindow, string.Format("{0} Duplicate file(s) found.\nFiles with same name will be overwritten in the final package, to avoid it, either rename or discard the duplicate files or enable Retain Folder Structure option.", duplicateFiles.Count()), "Duplicate Files", MessageBoxButton.OK, MessageBoxImage.Warning);
var DialogOptions = new Dictionary<Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags, bool>() { { Dynamo.UI.Prompts.DynamoMessageBox.DialogFlags.Scrollable, true } };
MessageBoxService.Show(System.Windows.Application.Current?.MainWindow, string.Format(Resources.DuplicateFilesInPublishWarningMessage.Replace("\\n", Environment.NewLine), duplicateFiles.Count, string.Join("\n", duplicateFiles.Select(x => x.Key).ToList())), Resources.DuplicateFilesInPublishWarningTitle, DialogOptions, MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
}
Expand Down

0 comments on commit 71c3210

Please sign in to comment.