Skip to content

Commit

Permalink
improved all implementations of iDisposable
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcadeRenegade committed Feb 1, 2016
1 parent 6826494 commit ec59ca8
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 63 deletions.
25 changes: 23 additions & 2 deletions SidebarDiagnostics/AppBarModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,27 @@ public AppBarModel()

public void Dispose()
{
DisposeClock();
DisposeMonitors();
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
DisposeClock();
DisposeMonitors();
}

_disposed = true;
}
}

~AppBarModel()
{
Dispose(false);
}

public void Restart()
Expand Down Expand Up @@ -188,5 +207,7 @@ public MonitorManager MonitorManager
private DispatcherTimer _clockTimer { get; set; }

private DispatcherTimer _monitorTimer { get; set; }

private bool _disposed { get; set; } = false;
}
}
Loading

0 comments on commit ec59ca8

Please sign in to comment.