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: Clear any element binding data from DYN upon SaveAs #14394

Merged
merged 16 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
20 changes: 19 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.

6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3720,4 +3720,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="PreferencesViewIncludeTimestampExportPathTooltip" xml:space="preserve">
<value>When toggled on, file names of exported images include date and time of export.</value>
</data>
<data name="ElementBindingWarningMessage" xml:space="preserve">
<value>A Save As command will treat the workspace as a completely new file and cause element binding to break. Choose Save to preserve element binding with the host document.</value>
</data>
<data name="ElementBindingWarningTitle" xml:space="preserve">
<value>Element Binding Warning</value>
</data>
</root>
6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3707,4 +3707,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="PreferencesViewIncludeTimestampExportPathTooltip" xml:space="preserve">
<value>When toggled on, file names of exported images include date and time of export.</value>
</data>
<data name="ElementBindingWarningMessage" xml:space="preserve">
<value>A Save As command will treat the workspace as a completely new file and cause element binding to break. Choose Save to preserve element binding with the host document.</value>
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="ElementBindingWarningTitle" xml:space="preserve">
<value>Element Binding Warning</value>
</data>
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
</root>
14 changes: 14 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Dynamo.Selection;
using Dynamo.UI.Prompts;
using Dynamo.Utilities;
using Dynamo.Wpf.ViewModels;
using Dynamo.Wpf.ViewModels.Core;
Expand Down Expand Up @@ -627,6 +628,19 @@ internal void Save(string filePath, bool isBackup = false, EngineController engi
{
// For intentional SaveAs either through UI or API calls, replace workspace elements' Guids and workspace Id
jo["Uuid"] = Guid.NewGuid().ToString();
if (jo["Bindings"] != JToken.Parse("[]"))
{
jo["Bindings"] = JToken.Parse("[]");
var result = DynamoMessageBox.Show( Wpf.Properties.Resources.ElementBindingWarningMessage,
Wpf.Properties.Resources.ElementBindingWarningTitle, MessageBoxButton.OKCancel,
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
MessageBoxImage.Warning);

if (result == MessageBoxResult.Cancel)
{
return;
}
}

saveContent = GuidUtility.UpdateWorkspaceGUIDs(jo.ToString());
}
else
Expand Down