mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
CP-36392: Inherit IDisposable
to avoid confusion
Classes didn't extend IDisposable Also used null propagation to tidy up method body Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
a310fa60cf
commit
2c5373323c
@ -77,7 +77,7 @@ namespace XenAdmin.ConsoleView
|
||||
get { return terminated; }
|
||||
}
|
||||
|
||||
private CustomCursor RemoteCursor = null;
|
||||
private CustomCursor RemoteCursor;
|
||||
private CustomCursor LocalCursor = new CustomCursor(Images.StaticImages.vnc_local_cursor, 2, 2);
|
||||
|
||||
/// <summary>
|
||||
@ -430,7 +430,7 @@ namespace XenAdmin.ConsoleView
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool DestroyIcon(IntPtr hIcon);
|
||||
|
||||
class CustomCursor
|
||||
class CustomCursor : IDisposable
|
||||
{
|
||||
private Cursor cursor = null;
|
||||
private IntPtr handle = IntPtr.Zero;
|
||||
|
@ -101,7 +101,7 @@ namespace XenAdmin.Controls
|
||||
|
||||
public void ClearRows()
|
||||
{
|
||||
foreach (CustomListRow row in Rows)
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
row.Dispose();
|
||||
}
|
||||
|
@ -32,12 +32,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace XenAdmin.Controls
|
||||
{
|
||||
public class CustomListRow
|
||||
public class CustomListRow : IDisposable
|
||||
{
|
||||
private Color ForeColor_ = SystemColors.ControlText;
|
||||
private Color BackColor_ = SystemColors.Control;
|
||||
@ -258,18 +258,14 @@ namespace XenAdmin.Controls
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (ForePen != null)
|
||||
ForePen.Dispose();
|
||||
if (BorderPen != null)
|
||||
BorderPen.Dispose();
|
||||
if (BackBrush != null)
|
||||
BackBrush.Dispose();
|
||||
if (SelectedBackBrush != null)
|
||||
SelectedBackBrush.Dispose();
|
||||
ForePen?.Dispose();
|
||||
BorderPen?.Dispose();
|
||||
BackBrush?.Dispose();
|
||||
SelectedBackBrush?.Dispose();
|
||||
|
||||
foreach (CustomListRow r in Children)
|
||||
foreach (var row in Children)
|
||||
{
|
||||
r.Dispose();
|
||||
row.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user