Skip to content

Commit

Permalink
DYN-6719 - show warning when installing, and log when loading a packa…
Browse files Browse the repository at this point in the history
…ge from 2.x in Dynamo 3.x (#15083)

tests pass - merging.
https://master-15.jenkins.autodesk.com/view/DYN/job/DYN-DevCI_Self_Service/1423/
(filterFrozentest) is marked failure on master.
  • Loading branch information
mjkkirschner authored Apr 15, 2024
1 parent 8a2d6a0 commit 5cab0ad
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 29 deletions.
7 changes: 2 additions & 5 deletions src/DynamoCore/Models/DynamoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3546,17 +3546,14 @@ private TaskDialogEventArgs DisplayEngineFailureMessage(Exception exception)
}

/// <summary>
/// Displays file open error dialog if the file is of a future version than the currently installed version
/// Displays file open error dialog if the file is of a future version than the currently installed version.
/// </summary>
/// <param name="fullFilePath"></param>
/// <param name="fileVersion"></param>
/// <param name="currVersion"></param>
/// <returns> true if the file must be opened and false otherwise </returns>
/// <returns> true if the file must be opened and false otherwise. </returns>
private bool DisplayFutureFileMessage(string fullFilePath, Version fileVersion, Version currVersion)
{
var fileVer = ((fileVersion != null) ? fileVersion.ToString() : Resources.UnknownVersion);
var currVer = ((currVersion != null) ? currVersion.ToString() : Resources.UnknownVersion);

string summary = Resources.FutureFileSummary;
var description = string.Format(Resources.FutureFileDescription, fullFilePath, fileVersion, currVersion);

Expand Down
31 changes: 29 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

11 changes: 10 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ Next assemblies were loaded several times:
<value>Has no dependecies</value>
</data>
<data name="PackageUseNewerDynamoMessageBoxTitle" xml:space="preserve">
<value>Package Uses Newer Version of {0}!</value>
<value>Package may not work in this version of {0}!</value>
</data>
<data name="PackageWarningMessageBoxTitle" xml:space="preserve">
<value>Package Warning</value>
Expand Down Expand Up @@ -3962,4 +3962,13 @@ To make this file into a new template, save it to a different folder, then move
<data name="DynamoXmlFileFormat" xml:space="preserve">
<value>Dynamo 1.x file format</value>
</data>
<data name="MessagePackageOlderDynamo" xml:space="preserve">
<value>The package or one of its dependencies use an older version of {0} than you are currently using. Do you want to continue?</value>
</data>
<data name="PackageUseOlderDynamoMessageBoxTitle" xml:space="preserve">
<value>Package may not work in this version of Dynamo {0}!</value>
</data>
<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>
</root>
15 changes: 12 additions & 3 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ You can always redownload the package.</value>
<value>The package or one of its dependencies contains Python scripts or binaries. Do you want to continue?</value>
</data>
<data name="MessagePackageNewerDynamo" xml:space="preserve">
<value>The package or one of its dependencies use a newer version of {0} than you are currently using. Do you want to continue?</value>
<value>This package or one of its dependencies were created for a newer version of Dynamo. It may not work in this version. Do you want to continue?</value>
</data>
<data name="MessageSelectAtLeastOneNode" xml:space="preserve">
<value>You must select at least one custom node.</value>
Expand Down Expand Up @@ -1048,7 +1048,7 @@ To avoid unintended behavior, uninstall the conflicting loaded package(s), resta
<value>Package Download</value>
</data>
<data name="PackageUseNewerDynamoMessageBoxTitle" xml:space="preserve">
<value>Package Uses Newer Version of {0}!</value>
<value>Package may not work in this version of {0}!</value>
</data>
<data name="PackageWarningMessageBoxTitle" xml:space="preserve">
<value>Package Warning</value>
Expand Down Expand Up @@ -3949,4 +3949,13 @@ To make this file into a new template, save it to a different folder, then move
<data name="DynamoXmlFileFormat" xml:space="preserve">
<value>Dynamo 1.x file format</value>
</data>
</root>
<data name="MessagePackageOlderDynamo" xml:space="preserve">
<value>This package or one of its dependencies were created for a previous version of Dynamo. It may not work in this version. Do you want to continue?</value>
</data>
<data name="PackageUseOlderDynamoMessageBoxTitle" xml:space="preserve">
<value>Package may not work in this version of {0}!</value>
</data>
<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>
</root>
5 changes: 5 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4278,6 +4278,7 @@ static Dynamo.UI.Prompts.DynamoMessageBox.Show(string messageBoxText, string cap
static Dynamo.UI.Prompts.DynamoMessageBox.Show(string messageBoxText, string caption, bool showRichTextBox, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon) -> System.Windows.MessageBoxResult
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.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 @@ -4823,10 +4824,12 @@ static Dynamo.Wpf.Properties.Resources.MessagePackageContainPythonScript.get ->
static Dynamo.Wpf.Properties.Resources.MessagePackageDepsInBuiltinPackages.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageNewerDynamo.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageNotFound.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageOlderDynamo.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageTargetOtherHosts.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageTargetOtherHosts2.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageTargetOtherHostShort.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackageVersionNotFound.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePackOlderDynamoLink.get -> string
static Dynamo.Wpf.Properties.Resources.MessagePortNameInvalid.get -> string
static Dynamo.Wpf.Properties.Resources.MessageRemovePythonPort.get -> string
static Dynamo.Wpf.Properties.Resources.MessageSamePackageDiffVersInBuiltinPackages.get -> string
Expand Down Expand Up @@ -5099,6 +5102,7 @@ static Dynamo.Wpf.Properties.Resources.PackageUploadStateReady.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUploadStateUploaded.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUploadStateUploading.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUseNewerDynamoMessageBoxTitle.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUseOlderDynamoMessageBoxTitle.get -> string
static Dynamo.Wpf.Properties.Resources.PackageViewContextMenuLoadText.get -> string
static Dynamo.Wpf.Properties.Resources.PackageViewContextMenuLoadTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.PackageWarningMessageBoxTitle.get -> string
Expand Down Expand Up @@ -5484,6 +5488,7 @@ static Dynamo.Wpf.Utilities.CompactBubbleHandler.Process(ProtoCore.Mirror.Mirror
static Dynamo.Wpf.Utilities.MessageBoxService.Show(string msg, string title, bool showRichTextBox, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage img) -> System.Windows.MessageBoxResult
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.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
8 changes: 5 additions & 3 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xmlns:p="clr-namespace:Dynamo.Wpf.Properties;assembly=DynamoCoreWpf"
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"
Expand All @@ -14,7 +13,8 @@
SizeToContent="WidthAndHeight"
Style="{DynamicResource DynamoWindowStyle}"
WindowStartupLocation="CenterOwner"
WindowStyle="None">
WindowStyle="None"
ToolTipService.IsEnabled="false">
<Window.Background>
<SolidColorBrush Opacity="0" />
</Window.Background>
Expand All @@ -34,7 +34,9 @@
<KeyBinding Command="Close" Key="Esc"/>
</Window.InputBindings>

<Grid Background="Transparent" MouseDown="UIElement_OnMouseDown">
<Grid Background="Transparent"
MouseDown="UIElement_OnMouseDown">

<Border Name="MainBorder"
Background="White"
CornerRadius="4 "
Expand Down
34 changes: 34 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,40 @@ public static MessageBoxResult Show(string messageBoxText, string caption, bool
/// <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="showRichTextBox">True if we will be using the RichTextBox instead of the usual one</param>
/// <param name="button">OK button shown in the MessageBox</param>
/// <param name="icon">Type of message: Warning, Error</param>
/// <returns></returns>
public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, bool showRichTextBox, 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 (showRichTextBox)
{
dynamoMessageBox.BodyTextBlock.Visibility = Visibility.Collapsed;
dynamoMessageBox.ContentRichTextBox.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>
/// <param name="owner">owner window</param>
/// <param name="messageBoxText"></param>
/// <param name="caption"></param>
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 @@ -11,6 +11,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, 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 @@ -29,6 +30,10 @@ MessageBoxResult IMessageBox.Show(string msg, string title, bool showRichTextBox
{
return DynamoMessageBox.Show(msg, title, showRichTextBox, button, img);
}
MessageBoxResult IMessageBox.Show(Window owner, string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img)
{
return DynamoMessageBox.Show(owner,msg, title, showRichTextBox, button, img);
}

public MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, MessageBoxImage img)
{
Expand Down Expand Up @@ -59,6 +64,10 @@ public static MessageBoxResult Show(string msg, string title, bool showRichTextB
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(msg, title, showRichTextBox, button, img);
}
public static MessageBoxResult Show(Window owner, string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner,msg, title, showRichTextBox, 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
Loading

0 comments on commit 5cab0ad

Please sign in to comment.