Skip to content

Commit

Permalink
single warning message (#14890)
Browse files Browse the repository at this point in the history
- trigger warning message only once when the user has attempted to load an existing dll from another path
  • Loading branch information
dnenov authored Jan 26, 2024
1 parent 5e05efc commit abbd28f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,10 @@ private void AddAdditionalFile(string filename)
}
}

// A boolean flag used to trigger only once the message prompt
// When the user has attempted to load an existing dll from another path
private bool duplicateAssemblyWarningTriggered = false;

private void AddDllFile(string filename)
{
try
Expand All @@ -1914,13 +1918,14 @@ private void AddDllFile(string filename)

// The user has attempted to load an existing dll from another path. This is not allowed
// as the existing assembly cannot be modified while Dynamo is active.
if (this.Assemblies.Any(x => assemName == x.Assembly.GetName().Name))
if (this.Assemblies.Any(x => assemName == x.Assembly.GetName().Name) && !duplicateAssemblyWarningTriggered)
{
MessageBoxService.Show(Owner, string.Format(Resources.PackageDuplicateAssemblyWarning,
dynamoViewModel.BrandingResourceProvider.ProductName),
Resources.PackageDuplicateAssemblyWarningTitle,
MessageBoxButton.OK,
MessageBoxImage.Stop);
duplicateAssemblyWarningTriggered = true;
return; // skip loading assembly
}

Expand Down

0 comments on commit abbd28f

Please sign in to comment.