CP-36392: Remove duplicate field in MultipleDvdIsoList.cs

Also remove `VM` from designer

Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
Danilo Del Busso 2021-09-17 16:09:58 +01:00
parent 157fe77f8f
commit a61f61d66f
No known key found for this signature in database
GPG Key ID: 55F556F9A25CB037
3 changed files with 11 additions and 16 deletions

View File

@ -207,7 +207,6 @@ namespace XenAdmin.ConsoleView
this.multipleDvdIsoList1.LabelSingleDvdForeColor = System.Drawing.SystemColors.ControlText; this.multipleDvdIsoList1.LabelSingleDvdForeColor = System.Drawing.SystemColors.ControlText;
this.multipleDvdIsoList1.LinkLabelLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.multipleDvdIsoList1.LinkLabelLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.multipleDvdIsoList1.Name = "multipleDvdIsoList1"; this.multipleDvdIsoList1.Name = "multipleDvdIsoList1";
this.multipleDvdIsoList1.VM = null;
// //
// pictureBox1 // pictureBox1
// //

View File

@ -52,22 +52,19 @@ namespace XenAdmin.Controls
InitializeComponent(); InitializeComponent();
} }
private VM vm; [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public VM VM public VM VM
{ {
set set
{ {
DeregisterEvents(); DeregisterEvents();
cdChanger1.VM = value; cdChanger1.VM = value;
vm = value; if (value != null)
if (vm != null) cdChanger1.VM.PropertyChanged += vm_PropertyChanged;
vm.PropertyChanged += vm_PropertyChanged;
refreshDrives(); refreshDrives();
} }
get get => cdChanger1.VM;
{
return cdChanger1.VM;
}
} }
#region Designer browsable properties #region Designer browsable properties
@ -100,17 +97,17 @@ namespace XenAdmin.Controls
internal virtual void DeregisterEvents() internal virtual void DeregisterEvents()
{ {
if (vm == null) if (VM == null)
return; return;
// remove VM listeners // remove VM listeners
vm.PropertyChanged -= vm_PropertyChanged; VM.PropertyChanged -= vm_PropertyChanged;
// remove cache listener // remove cache listener
vm.Connection.CachePopulated -= CachePopulatedMethod; VM.Connection.CachePopulated -= CachePopulatedMethod;
// remove VBD listeners // remove VBD listeners
var vbds = vm.Connection.ResolveAll(VM.VBDs); var vbds = VM.Connection.ResolveAll(VM.VBDs);
foreach (var vbd in vbds.Where(vbd => vbd.IsCDROM() || vbd.IsFloppyDrive())) foreach (var vbd in vbds.Where(vbd => vbd.IsCDROM() || vbd.IsFloppyDrive()))
{ {
@ -178,7 +175,7 @@ namespace XenAdmin.Controls
labelSingleDvd.Visible = false; labelSingleDvd.Visible = false;
linkLabel1.Visible = false; linkLabel1.Visible = false;
panel1.Visible = false; panel1.Visible = false;
newCDLabel.Visible = vm != null && !vm.is_control_domain; newCDLabel.Visible = VM != null && !VM.is_control_domain;
} }
else if (comboBoxDrive.Items.Count == 1) else if (comboBoxDrive.Items.Count == 1)

View File

@ -348,7 +348,6 @@ namespace XenAdmin.TabPages
this.multipleDvdIsoList1.LabelSingleDvdForeColor = System.Drawing.SystemColors.ControlText; this.multipleDvdIsoList1.LabelSingleDvdForeColor = System.Drawing.SystemColors.ControlText;
this.multipleDvdIsoList1.LinkLabelLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.multipleDvdIsoList1.LinkLabelLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.multipleDvdIsoList1.Name = "multipleDvdIsoList1"; this.multipleDvdIsoList1.Name = "multipleDvdIsoList1";
this.multipleDvdIsoList1.VM = null;
// //
// dataGridViewTextBoxColumn1 // dataGridViewTextBoxColumn1
// //