Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart90 committed Feb 20, 2024
1 parent 0c8a675 commit 6a834a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/GraphNodeManagerViewExtension/GraphNodeManagerView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
Expand All @@ -11,7 +12,7 @@ namespace Dynamo.GraphNodeManager
/// <summary>
/// Interaction logic for GraphNodeManagerView.xaml
/// </summary>
public partial class GraphNodeManagerView : UserControl
public partial class GraphNodeManagerView : UserControl, IDisposable
{
/// <summary>
/// A persistent handle of the currently selected row
Expand All @@ -29,6 +30,7 @@ public partial class GraphNodeManagerView : UserControl
private bool mouseHandled = false;

private GraphNodeManagerViewModel viewModel;
private bool disposedValue;

/// <summary>
/// Constructor
Expand Down Expand Up @@ -154,5 +156,22 @@ private void ExportButton_OnClick(object sender, RoutedEventArgs e)
e.Handled = true;
}

protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
viewModel.PropertyChanged -= ViewModel_OnPropertyChanged;
viewModel.RequestExportGraph -= ViewModel_RequestExportGraph;

disposedValue = true;
}
}

public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ private void MenuItemCheckHandler(object sender, RoutedEventArgs e)
/// <param name="e"></param>
private void MenuItemUnCheckedHandler(object sender, RoutedEventArgs e)
{
this.Dispose();
viewLoadedParamsReference.CloseExtensioninInSideBar(this);
}

Expand Down Expand Up @@ -110,6 +109,7 @@ public override void Shutdown()
/// </summary>
public override void Dispose()
{
this.ManagerView?.Dispose();
this.ViewModel?.Dispose();
this.ManagerView = null;
this.ViewModel = null;
Expand Down

0 comments on commit 6a834a3

Please sign in to comment.