Skip to content

Commit

Permalink
[BUG] Performance Issues with Permission Box (#751)
Browse files Browse the repository at this point in the history
* Create draft PR for #750

* Remove instantiated Permission boxes upon disposal.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mhareznik <101903843+mhareznik@users.noreply.github.com>
Co-authored-by: peterbarancek <62284244+peterbarancek@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent 20a4320 commit 5cde056
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ public PermissionBox()
this.Loaded += PermissionBox_Loaded;
}


public static void RemovePermissionBox(PermissionBox boxToRemove)
{
boxToRemove.Loaded -= boxToRemove.PermissionBox_Loaded;
permissionBoxes.Remove(boxToRemove);
}

private void PermissionBox_Loaded(object sender, RoutedEventArgs e)
{
UpdateThis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using TcoInspectors;
using TcOpen.Inxton.Local.Security.Wpf;

namespace TcoInspectors
{
Expand Down Expand Up @@ -54,6 +55,7 @@ public void Dispose()
this.DataContextChanged -= TcoInspectorDialogView_DataContextChanged;
if (context != null)
{
PermissionBox.RemovePermissionBox(this.PermissionBoxOverrideCommand);
context.CloseRequestEventHandler -= (s, ev) => this.Close();
}
}
Expand Down

0 comments on commit 5cde056

Please sign in to comment.