diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index ccf77f9158c..6d3fbf22da3 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -1315,6 +1315,24 @@ public static string DownloadWarningMessageBoxTitle { } } + /// + /// Looks up a localized string similar to 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}. + /// + public static string DuplicateFilesInPublishWarningMessage { + get { + return ResourceManager.GetString("DuplicateFilesInPublishWarningMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Duplicate Files. + /// + public static string DuplicateFilesInPublishWarningTitle { + get { + return ResourceManager.GetString("DuplicateFilesInPublishWarningTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show File Trust Warning. /// diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index 28f58ba9e91..25ffdeaca29 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -582,7 +582,7 @@ Don't worry, you'll have the option to save your work. _Select All Edit menu | Select all nodes - + _Unpin All Preview Bubbles Edit menu | Unpin preview bubbles @@ -3975,4 +3975,10 @@ To make this file into a new template, save it to a different folder, then move #Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8 + + 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} + + + Duplicate Files + \ No newline at end of file diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index dcb104b3f26..6ddd041f758 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -330,7 +330,7 @@ _Select All Edit menu | Select all nodes - + _Unpin All Preview Bubbles Edit menu | Unpin preview bubbles @@ -3962,4 +3962,10 @@ To make this file into a new template, save it to a different folder, then move #Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8 + + 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} + + + Duplicate Files + \ No newline at end of file diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index 15bd18573ac..68a9b281177 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -1514,6 +1514,8 @@ Dynamo.UI.IViewModelView.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 @@ -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 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 @@ -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 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 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 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 diff --git a/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml b/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml index 434fcead8db..a5c05c44a15 100644 --- a/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml +++ b/src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml @@ -139,8 +139,18 @@ + + + + + public string Tooltip { get; private set; } + /// + /// A list of customization options for dialog box + /// + public enum DialogFlags + { + //Enables scrollable text in the message box + Scrollable = 0, + } + #endregion /// @@ -204,6 +213,7 @@ public static MessageBoxResult Show(Window owner, string messageBoxText, string dynamoMessageBox.ShowDialog(); return dynamoMessageBox.CustomDialogResult; } + /// /// Displays a dialog to the user and returns their choice as a MessageBoxResult. /// @@ -234,6 +244,41 @@ public static MessageBoxResult Show(Window owner,string messageBoxText, string c return dynamoMessageBox.CustomDialogResult; } + /// + /// Displays a dialog to the user and returns their choice as a MessageBoxResult. + /// + /// owning window of the messagebox + /// Content of the message + /// MessageBox title + /// Provide a list of flags that can be used to customize the dialog box, e.g Scrollable + /// Type of button shown in the MessageBox: Ok, OkCancel; etc + /// Type of message: Warning, Error + /// + public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, Dictionary 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; + } + /// /// Displays a dialog to the user and returns their choice as a MessageBoxResult. /// diff --git a/src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs b/src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs index 7bb7dde8969..c3da445ea1f 100644 --- a/src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs +++ b/src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs @@ -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 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 buttonNames, MessageBoxImage img); MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable buttonNames, MessageBoxImage img); @@ -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 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) { @@ -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 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); diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs index 55e30c803e5..3cb1025dafb 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs @@ -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.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); } } }