diff --git a/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs b/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs
index 790fe323022..0601cf567e4 100644
--- a/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs
+++ b/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs
@@ -4,25 +4,22 @@
using System.IO;
using System.Linq;
using System.Security.Permissions;
-using System.Web.UI.WebControls;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
-using DesignScript.Builtin;
using Dynamo.Configuration;
-using Dynamo.Core;
using Dynamo.DocumentationBrowser.Properties;
using Dynamo.Graph;
using Dynamo.Graph.Annotations;
using Dynamo.Graph.Workspaces;
using Dynamo.Logging;
-using Dynamo.Selection;
using Dynamo.Models;
-using DynamoProperties = Dynamo.Properties;
using Dynamo.PackageManager;
+using Dynamo.Selection;
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
using Dynamo.Wpf.Interfaces;
+using DynamoProperties = Dynamo.Properties;
using MenuItem = System.Windows.Controls.MenuItem;
namespace Dynamo.DocumentationBrowser
@@ -179,8 +176,7 @@ public override void Loaded(ViewLoadedParams viewLoadedParams)
this.ViewModel.DynamoView = viewLoadedParams.DynamoWindow;
}
-
- public void Shutdown()
+ public override void Shutdown()
{
Dispose();
}
diff --git a/src/DynamoCore/Configuration/PreferenceSettings.cs b/src/DynamoCore/Configuration/PreferenceSettings.cs
index b60a62a14e4..848b7253209 100644
--- a/src/DynamoCore/Configuration/PreferenceSettings.cs
+++ b/src/DynamoCore/Configuration/PreferenceSettings.cs
@@ -54,6 +54,7 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
private double defaultScaleFactor;
private bool disableTrustWarnings = false;
private bool isNotificationCenterEnabled;
+ private bool isEnablePersistExtensionsEnabled;
private bool isStaticSplashScreenEnabled;
private bool isCreatedFromValidFile = true;
private bool isADPChecked = false;
@@ -575,6 +576,22 @@ public bool EnableNotificationCenter
}
}
+ ///
+ /// This defines if user wants the Extensions settings to persist across sessions.
+ ///
+ public bool EnablePersistExtensions
+ {
+ get
+ {
+ return isEnablePersistExtensionsEnabled;
+ }
+ set
+ {
+ isEnablePersistExtensionsEnabled = value;
+ RaisePropertyChanged(nameof(EnablePersistExtensions));
+ }
+ }
+
///
/// This defines if the user wants to see the static splash screen again
diff --git a/src/DynamoCore/Configuration/ViewExtensionSettings.cs b/src/DynamoCore/Configuration/ViewExtensionSettings.cs
index dab39791c28..2efd27a0ad6 100644
--- a/src/DynamoCore/Configuration/ViewExtensionSettings.cs
+++ b/src/DynamoCore/Configuration/ViewExtensionSettings.cs
@@ -1,4 +1,4 @@
-namespace Dynamo.Configuration
+namespace Dynamo.Configuration
{
///
/// Settings that apply to a view extension specifically.
@@ -21,6 +21,10 @@ public class ViewExtensionSettings
/// Window settings for the extension control when displayed in FloatingWindow mode.
///
public WindowSettings WindowSettings { get; set; }
+ ///
+ /// Specifies if the extension was Open in the last session before closing Dynamo, if the property to remember view extension status was enabled.
Default: False
+ ///
+ public bool IsOpen { get; set; }
}
///
@@ -83,4 +87,4 @@ public enum WindowStatus
///
Maximized
}
-}
\ No newline at end of file
+}
diff --git a/src/DynamoCoreWpf/Extensions/ViewExtensionBase.cs b/src/DynamoCoreWpf/Extensions/ViewExtensionBase.cs
index 1b7b84621c7..562b3ff1b08 100644
--- a/src/DynamoCoreWpf/Extensions/ViewExtensionBase.cs
+++ b/src/DynamoCoreWpf/Extensions/ViewExtensionBase.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
namespace Dynamo.Wpf.Extensions
{
///
@@ -70,6 +64,15 @@ public virtual void Startup(ViewStartupParams viewStartupParams)
}
+ ///
+ /// Action to be invoked when Dynamo starts up, to re-open the view extension which was open in the last session, if the preference setting
+ /// to remember the last opened extensions was enabled.
+ ///
+ public virtual void ReOpen()
+ {
+
+ }
+
///
/// Action to be invoked when the view extension is closed.
///
@@ -78,4 +81,4 @@ public virtual void Closed()
}
}
-}
\ No newline at end of file
+}
diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs
index 957d2f1cb24..c18b4bc8e87 100644
--- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs
+++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs
@@ -6674,6 +6674,15 @@ public static string PreferencesViewEnableNotificationCenter {
}
}
+ ///
+ /// Looks up a localized string similar to On launch, remember open extensions panels from last session.
+ ///
+ public static string PreferencesViewEnablePersistExtensions {
+ get {
+ return ResourceManager.GetString("PreferencesViewEnablePersistExtensions", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Enable T-Spline nodes.
///
@@ -6692,6 +6701,15 @@ public static string PreferencesViewExperimentalLabel {
}
}
+ ///
+ /// Looks up a localized string similar to Extensions.
+ ///
+ public static string PreferencesViewExtensions {
+ get {
+ return ResourceManager.GetString("PreferencesViewExtensions", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Features.
///
diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx
index 9e6268c7951..cd0b11ce0f5 100644
--- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx
+++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx
@@ -3494,6 +3494,13 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
Library
+
+ On launch, remember open extensions panels from last session
+
+
+ Extensions
+ Preferences | Features | Extensions
+
Drag to adjust Python Editor zoom scale between 10% and 100%. You can also adjust this in Python Editor by pressing Shift and scrolling the mouse wheel.
diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx
index 78fdffe043e..cf17fa0eea8 100644
--- a/src/DynamoCoreWpf/Properties/Resources.resx
+++ b/src/DynamoCoreWpf/Properties/Resources.resx
@@ -3481,6 +3481,13 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
Library
+
+ On launch, remember open extensions panels from last session
+
+
+ Extensions
+ Preferences | Features | Extensions
+
Drag to adjust Python Editor zoom scale between 10% and 100%. You can also adjust this in Python Editor by pressing Shift and scrolling the mouse wheel.
diff --git a/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs b/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
index 534348341ad..2ec1773e013 100644
--- a/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
+++ b/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
@@ -771,7 +771,7 @@ public string SelectedPythonEngine
}
///
- /// Controls the IsChecked property in the "Hide IronPython alerts" toogle button
+ /// Controls the IsChecked property in the "Hide IronPython alerts" toggle button
///
public bool HideIronPythonAlertsIsChecked
{
@@ -787,7 +787,7 @@ public bool HideIronPythonAlertsIsChecked
}
///
- /// Controls the IsChecked property in the "Show Whitespace in Python editor" toogle button
+ /// Controls the IsChecked property in the "Show Whitespace in Python editor" toggle button
///
public bool ShowWhitespaceIsChecked
{
@@ -804,7 +804,7 @@ public bool ShowWhitespaceIsChecked
}
///
- /// Controls the IsChecked property in the "Notification Center" toogle button
+ /// Controls the IsChecked property in the "Notification Center" toggle button
///
public bool NotificationCenterIsChecked
{
@@ -819,6 +819,23 @@ public bool NotificationCenterIsChecked
}
}
+ ///
+ /// Controls the IsChecked property in the "Extensions" toggle button, to enable persisted extensions, that will remember
+ /// extensions setting as per the last session.
+ ///
+ public bool PersistExtensionsIsChecked
+ {
+ get
+ {
+ return preferenceSettings.EnablePersistExtensions;
+ }
+ set
+ {
+ preferenceSettings.EnablePersistExtensions = value;
+ RaisePropertyChanged(nameof(PersistExtensionsIsChecked));
+ }
+ }
+
#region [ Node Autocomplete ]
///
diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
index 95234466e67..12d33873af4 100644
--- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
+++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
@@ -63,6 +63,7 @@ namespace Dynamo.Controls
public partial class DynamoView : Window, IDisposable
{
public const string BackgroundPreviewName = "BackgroundPreview";
+ private const int SideBarCollapseThreshold = 20;
private const int navigationInterval = 100;
// This is used to determine whether ESC key is being held down
private bool IsEscKeyPressed = false;
@@ -324,6 +325,11 @@ internal bool AddOrFocusExtensionControl(IViewExtension viewExtension, UIElement
this.dynamoViewModel.PreferenceSettings.ViewExtensionSettings.Add(settings);
}
+ if (this.dynamoViewModel.PreferenceSettings.EnablePersistExtensions)
+ {
+ settings.IsOpen = true;
+ }
+
if (settings.DisplayMode == ViewExtensionDisplayMode.FloatingWindow)
{
window = AddExtensionWindow(viewExtension, content, settings.WindowSettings);
@@ -969,6 +975,7 @@ private void DynamoLoadedViewExtensionHandler(ViewLoadedParams loadedParams, IEn
try
{
ext.Loaded(loadedParams);
+ ReOpenSavedExtensionOnDynamoStartup(ext);
}
catch (Exception exc)
{
@@ -977,6 +984,27 @@ private void DynamoLoadedViewExtensionHandler(ViewLoadedParams loadedParams, IEn
}
}
+ ///
+ /// This method will re-open saved extension from last session,
+ /// if the setting to remember last opened extensions was enabled.
+ ///
+ /// Extension to be re-opened, if saved from last session.
+ private void ReOpenSavedExtensionOnDynamoStartup(IViewExtension ext)
+ {
+ var viewExtensionSettings = dynamoViewModel.PreferenceSettings.EnablePersistExtensions ? dynamoViewModel.PreferenceSettings.ViewExtensionSettings : null;
+ if (viewExtensionSettings != null && viewExtensionSettings.Count > 0)
+ {
+ var setting = viewExtensionSettings.Find(s => s.UniqueId == ext.UniqueId);
+ if (setting != null && setting.IsOpen)
+ {
+ if (ext is ViewExtensionBase viewExtensionBase)
+ {
+ viewExtensionBase.ReOpen();
+ }
+ }
+ }
+ }
+
private void DynamoView_Loaded(object sender, EventArgs e)
{
// Do an initial load of the cursor collection
@@ -1586,7 +1614,7 @@ private bool PerformShutdownSequenceOnViewModel()
private void WindowClosing(object sender, CancelEventArgs e)
{
- SaveExtensionWindowsState();
+ SaveExtensionsState();
if (!PerformShutdownSequenceOnViewModel() && !DynamoModel.IsTestMode)
{
@@ -1599,14 +1627,57 @@ private void WindowClosing(object sender, CancelEventArgs e)
}
///
- /// Saves the state of currently displayed extension windows. This is needed because the closing event is
+ /// Saves the state of currently displayed extension windows and tabs. This is needed because the closing event is
/// not called on child windows: https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.closing
///
- private void SaveExtensionWindowsState()
+ private void SaveExtensionsState()
{
+ //loop over all active extension windows and tabs.
foreach (var window in ExtensionWindows.Values)
{
SaveExtensionWindowSettings(window);
+ SaveExtensionOpenState(window);
+ }
+ //for any new extensions that are opened for the first time
+ foreach (var tab in ExtensionTabItems)
+ {
+ SaveExtensionOpenState(tab);
+ }
+ //update open state of all existing view extension in setting, if option to remember extensions is enabled in preferences
+ var settings = dynamoViewModel.PreferenceSettings.ViewExtensionSettings;
+ foreach (var setting in settings)
+ {
+ if (!ExtensionTabItems.Any(e => e.Uid == setting.UniqueId) && !ExtensionWindows.Values.Any(e => e.Uid == setting.UniqueId))
+ {
+ setting.IsOpen = false;
+ }
+ }
+ }
+ //This method is to ensure that the extensions states are correctly saved for newly added extensions.
+ private void SaveExtensionOpenState(object o)
+ {
+ if (!dynamoViewModel.PreferenceSettings.EnablePersistExtensions || o == null) return;
+
+ var extId = string.Empty;
+ switch (o)
+ {
+ case TabItem t:
+ extId = t.Uid;
+ break;
+ case ExtensionWindow w:
+ extId = w.Uid;
+ break;
+ default:
+ Log("Incorrect extension type, could not save extension state.");
+ break;
+ }
+
+ if (string.IsNullOrEmpty(extId)) return;
+
+ var setting = dynamoViewModel.Model.PreferenceSettings.ViewExtensionSettings?.Find(ext => ext.UniqueId == extId);
+ if (setting != null)
+ {
+ setting.IsOpen = true;
}
}
@@ -2166,7 +2237,7 @@ public bool LibraryCollapsed
get
{
// Threshold that determines if button should be displayed
- if (LeftExtensionsViewColumn.Width.Value < 20)
+ if (LeftExtensionsViewColumn.Width.Value < SideBarCollapseThreshold)
{ libraryCollapsed = true; }
else
@@ -2192,7 +2263,7 @@ public bool ExtensionsCollapsed
}
else
{
- extensionsCollapsed = RightExtensionsViewColumn.Width.Value < 20;
+ extensionsCollapsed = RightExtensionsViewColumn.Width.Value < SideBarCollapseThreshold;
}
return extensionsCollapsed;
diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
index 490e5b870e7..6b6f685b4f3 100644
--- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
+++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
@@ -541,6 +541,7 @@
+
@@ -902,6 +903,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/GraphMetadataViewExtension/GraphMetadataViewExtension.cs b/src/GraphMetadataViewExtension/GraphMetadataViewExtension.cs
index 6c709fecb0b..06e414fed7d 100644
--- a/src/GraphMetadataViewExtension/GraphMetadataViewExtension.cs
+++ b/src/GraphMetadataViewExtension/GraphMetadataViewExtension.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows.Controls;
using System.Collections.Generic;
using Dynamo.Extensions;
@@ -41,6 +41,11 @@ private void MenuItemUnCheckedHandler(object sender, RoutedEventArgs e)
}
private void MenuItemCheckHandler(object sender, RoutedEventArgs e)
+ {
+ AddToSidebar();
+ }
+
+ private void AddToSidebar()
{
// Dont allow the extension to show in anything that isnt a HomeWorkspaceModel
if (!(this.viewLoadedParamsReference.CurrentWorkspaceModel is HomeWorkspaceModel))
@@ -52,6 +57,12 @@ private void MenuItemCheckHandler(object sender, RoutedEventArgs e)
this.viewLoadedParamsReference?.AddToExtensionsSideBar(this, this.graphMetadataView);
}
+ public override void ReOpen()
+ {
+ AddToSidebar();
+ this.graphMetadataMenuItem.IsChecked = true;
+ }
+
#region Storage Access implementation
///
diff --git a/src/GraphNodeManagerViewExtension/GraphNodeManagerViewExtension.cs b/src/GraphNodeManagerViewExtension/GraphNodeManagerViewExtension.cs
index 70b717494a0..2dea9841cbf 100644
--- a/src/GraphNodeManagerViewExtension/GraphNodeManagerViewExtension.cs
+++ b/src/GraphNodeManagerViewExtension/GraphNodeManagerViewExtension.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Controls;
using Dynamo.Logging;
@@ -32,6 +32,7 @@ public class GraphNodeManagerViewExtension : ViewExtensionBase, IViewExtension,
/// Extension Name
///
public override string Name => Properties.Resources.ExtensionName;
+
#endregion
#region Add/Remove Extension
@@ -92,6 +93,12 @@ private void AddToSidebar()
this.viewLoadedParamsReference?.AddToExtensionsSideBar(this, this.ManagerView);
}
+
+ public override void ReOpen()
+ {
+ AddToSidebar();
+ this.graphNodeManagerMenuItem.IsChecked = true;
+ }
#endregion
#region Dispose
diff --git a/src/LintingViewExtension/LintingViewExtension.cs b/src/LintingViewExtension/LintingViewExtension.cs
index b486ad7ffec..b2af77ba4ab 100644
--- a/src/LintingViewExtension/LintingViewExtension.cs
+++ b/src/LintingViewExtension/LintingViewExtension.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
diff --git a/src/NodeAutoCompleteViewExtension/NodeAutoCompleteViewExtension.cs b/src/NodeAutoCompleteViewExtension/NodeAutoCompleteViewExtension.cs
index c9742deb69d..159f737c9bf 100644
--- a/src/NodeAutoCompleteViewExtension/NodeAutoCompleteViewExtension.cs
+++ b/src/NodeAutoCompleteViewExtension/NodeAutoCompleteViewExtension.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Dynamo.Extensions;
using Dynamo.Logging;
using Dynamo.Wpf.Extensions;
diff --git a/src/PackageDetailsViewExtension/PackageDetailsViewExtension.cs b/src/PackageDetailsViewExtension/PackageDetailsViewExtension.cs
index 52c76131e3b..426a64198f6 100644
--- a/src/PackageDetailsViewExtension/PackageDetailsViewExtension.cs
+++ b/src/PackageDetailsViewExtension/PackageDetailsViewExtension.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using Dynamo.PackageManager;
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
@@ -70,4 +70,4 @@ public override void Closed()
PackageDetailsView = null;
}
}
-}
\ No newline at end of file
+}
diff --git a/test/DynamoCoreWpfTests/ViewExtensions/GraphNodeManagerViewExtensionTests.cs b/test/DynamoCoreWpfTests/ViewExtensions/GraphNodeManagerViewExtensionTests.cs
index 45e9659ec1e..5f7a843af14 100644
--- a/test/DynamoCoreWpfTests/ViewExtensions/GraphNodeManagerViewExtensionTests.cs
+++ b/test/DynamoCoreWpfTests/ViewExtensions/GraphNodeManagerViewExtensionTests.cs
@@ -2,10 +2,14 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Threading;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Markup;
using System.Windows.Media;
using Dynamo.Configuration;
+using Dynamo.Controls;
+using Dynamo.Graph.Connectors;
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Workspaces;
using Dynamo.GraphNodeManager;
@@ -14,6 +18,8 @@
using Dynamo.Models;
using Dynamo.Scheduler;
using Dynamo.Utilities;
+using Dynamo.ViewModels;
+using Dynamo.Wpf.Extensions;
using NUnit.Framework;
using ProtoCore.Mirror;
@@ -25,13 +31,17 @@ public class GraphNodeManagerViewExtensionTests : DynamoTestUIBase
protected override DynamoModel.IStartConfiguration CreateStartConfiguration(IPathResolver pathResolver)
{
+ string settingDirectory = Path.Combine(GetTestDirectory(ExecutingDirectory), "settings");
+ string viewExtSettingFilePath = Path.Combine(settingDirectory, "DynamoSettings-ViewExtension.xml");
+ PreferenceSettings.DynamoTestPath = viewExtSettingFilePath;
+
return new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = TaskProcessMode.Synchronous,
- Preferences = new PreferenceSettings() { CustomPackageFolders = new List() { this.PackagesDirectory } }
+ Preferences = PreferenceSettings.Load(viewExtSettingFilePath)
};
}
@@ -202,6 +212,111 @@ public void ContainsEmptyListOrNullTest()
Assert.AreEqual(nullNodesCount, nullNodesImageCount);
}
+ #region EnablePersistExtensions Tests
+ ///
+ /// Test if the Extension loads correctly when remembered
+ ///
+ [Test]
+ public void ViewExtensionOpensWithDynamoWhenRememberedTest()
+ {
+ RaiseLoadedEvent(this.View);
+ ViewModel.PreferenceSettings.EnablePersistExtensions = true;
+
+ //assert that option is enabled
+ Assert.IsTrue(ViewModel.PreferenceSettings.EnablePersistExtensions);
+
+ //open extension
+ var extensionManager = View.viewExtensionManager;
+ var viewExtension = extensionManager.ViewExtensions
+ .FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
+ as GraphNodeManagerViewExtension;
+ LoadExtension(viewExtension);
+
+ //confirm that extension was opened
+ Assert.AreEqual(1, View.ExtensionTabItems.Count);
+
+ //Restart Dynamo
+ Exit();
+ Start();
+
+ Utility.DispatcherUtil.DoEvents();
+
+ //confirm that extension is reopened after restart
+ Assert.AreEqual(1, View.ExtensionTabItems.Count);
+ Assert.IsNotNull(View.ExtensionTabItems.FirstOrDefault(x => x.Tag as GraphNodeManagerViewExtension != null));
+ }
+
+ ///
+ /// Test if the Extension does not open when closed in the last session, and remember setting was enabled.
+ ///
+ [Test]
+ public void ViewExtensionDoesNotOpensWithDynamoWhenClosedTest()
+ {
+ RaiseLoadedEvent(this.View);
+ ViewModel.PreferenceSettings.EnablePersistExtensions = true;
+
+ //assert that option is enabled
+ Assert.IsTrue(ViewModel.PreferenceSettings.EnablePersistExtensions);
+
+ //open extension
+ var extensionManager = View.viewExtensionManager;
+ var viewExtension = extensionManager.ViewExtensions
+ .FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
+ as GraphNodeManagerViewExtension;
+ LoadExtension(viewExtension);
+
+ //close extension
+ var loadedParams = new ViewLoadedParams(View, ViewModel);
+ loadedParams.CloseExtensioninInSideBar(viewExtension);
+
+ //confirm that extension was closed
+ Assert.AreEqual(0, View.ExtensionTabItems.Count);
+
+ //Restart Dynamo
+ Exit();
+ Start();
+
+ Utility.DispatcherUtil.DoEvents();
+
+ //confirm that extension is still closed after restart
+ Assert.AreEqual(0, View.ExtensionTabItems.Count);
+ Assert.IsNull(View.ExtensionTabItems.FirstOrDefault(x => x.Tag as GraphNodeManagerViewExtension != null));
+ }
+
+ ///
+ /// Test if the Extension loads correctly when remembered
+ ///
+ [Test]
+ public void ViewExtensionDoesNotOpenWhenNotRememberedTest()
+ {
+ RaiseLoadedEvent(this.View);
+ ViewModel.PreferenceSettings.EnablePersistExtensions = false;
+
+ //assert that option is disabled
+ Assert.IsFalse(ViewModel.PreferenceSettings.EnablePersistExtensions);
+
+ //open extension
+ var extensionManager = View.viewExtensionManager;
+ var viewExtension = extensionManager.ViewExtensions
+ .FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
+ as GraphNodeManagerViewExtension;
+ LoadExtension(viewExtension);
+
+ //confirm that extension was opened
+ Assert.AreEqual(1, View.ExtensionTabItems.Count);
+
+ //Restart Dynamo
+ Exit();
+ Start();
+
+ Utility.DispatcherUtil.DoEvents();
+
+ //confirm that extension is still closed after restart
+ Assert.AreEqual(0, View.ExtensionTabItems.Count);
+ Assert.IsNull(View.ExtensionTabItems.FirstOrDefault(x => x.Tag as GraphNodeManagerViewExtension != null));
+ }
+ #endregion
+
#endregion
#region Utilities
diff --git a/test/settings/DynamoSettings-NewSettings.xml b/test/settings/DynamoSettings-NewSettings.xml
index d8dfe6351f3..f4d7ffc4d9a 100644
--- a/test/settings/DynamoSettings-NewSettings.xml
+++ b/test/settings/DynamoSettings-NewSettings.xml
@@ -71,6 +71,7 @@
5
false
false
+ true
C:\Users\jesus.alvino\AppData\Roaming\Dynamo\Dynamo Core\2.16
diff --git a/test/settings/DynamoSettings-ViewExtension.xml b/test/settings/DynamoSettings-ViewExtension.xml
new file mode 100644
index 00000000000..5899ca3230a
--- /dev/null
+++ b/test/settings/DynamoSettings-ViewExtension.xml
@@ -0,0 +1,103 @@
+
+
+ false
+ true
+ 304
+ en-US
+ 0
+ true
+ true
+ true
+ true
+ 100
+ 22
+ BEZIER
+
+
+ IsBackgroundPreviewActive
+ true
+
+
+ true
+ 0
+ 128
+ false
+ true
+ 0
+ 0
+ 1024
+ 768
+ true
+ f3
+ 10
+
+
+
+ %BuiltInPackages%
+ C:\rmWorkspace\github\Dynamo\test\pkgs
+ C:\Users\aggarwas\AppData\Roaming\Dynamo\Dynamo Core\2.18
+ C:\ProgramData\Dynamo\Dynamo Core\2.18\packages
+
+ false
+
+
+
+ 60000
+ 1
+ false
+ false
+ false
+ false
+ true
+ false
+ 10
+ 10
+ true
+ true
+ true
+
+ C:\Users\aggarwas\AppData\Roaming\Dynamo\Dynamo Core\2.18
+
+ ProtoGeometry.dll:Autodesk.DesignScript.Geometry.TSpline
+
+
+ false
+ false
+ Automatic
+ MLRecommendation
+ false
+
+
+ Actions
+ B9F9E1
+ true
+ 36
+ 4d68be4a-a04d-4945-9dd5-cdf61079d790
+
+
+ Inputs
+ FFB8D8
+ true
+ 36
+ 883066aa-1fe2-44a4-9bd1-c3df86bfe9f6
+
+
+ Outputs
+ FFC999
+ true
+ 36
+ 07655dc1-2d65-4fed-8d6a-37235d3e3a8d
+
+
+ Review
+ A4E1FF
+ true
+ 36
+ bc688959-ce34-4bf5-90f8-6ddd23f80989
+
+
+ 300
+ 2.4.0
+
+
+