xenadmin/XenAdmin/Wizards/BootModesControl.cs
Tim Liu 685a53bc22 CP-28679: XC: Allow choosing boot options during disk import (#2203)
* CP-28679: XC: Allow choosing boot options during disk import

Signed-off-by: Tim Liu <tim.liu@citrix.com>

* CP-28679: XC: Allow choosing boot options during disk import

1. Keep spaces instead of tabs
2. Update page header text to reflect the new control
3. Refine UI

Signed-off-by: Tim Liu <tim.liu@citrix.com>
2018-08-31 02:02:33 +01:00

90 lines
3.3 KiB
C#

/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System.ComponentModel;
using System.Windows.Forms;
using XenAPI;
using BootMode = XenAdmin.Actions.VMActions.BootMode;
namespace XenAdmin.Wizards
{
public partial class BootModesControl : UserControl
{
public BootModesControl()
{
InitializeComponent();
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public VM TemplateVM
{
get { return _templateVM; }
set
{
if (_templateVM == value)
return;
_templateVM = value;
if (_templateVM != null && _templateVM.IsHVM())
{
radioButtonUEFIBoot.Enabled = _templateVM.CanSupportUEFIBoot();
radioButtonUEFISecureBoot.Enabled = _templateVM.CanSupportUEFISecureBoot();
if (_templateVM.IsUEFIEnabled())
if (_templateVM.IsSecureBootEnabled())
radioButtonUEFISecureBoot.Checked = true;
else
radioButtonUEFIBoot.Checked = true;
else
radioButtonBIOSBoot.Checked = true;
}
else
{
radioButtonBIOSBoot.Checked = false;
radioButtonUEFIBoot.Checked = false;
radioButtonUEFISecureBoot.Checked = false;
}
}
}
private VM _templateVM;
public BootMode SelectedOption
{
get { return radioButtonUEFISecureBoot.Checked ? BootMode.UEFI_SECURE_BOOT : (radioButtonUEFIBoot.Checked ? BootMode.UEFI_BOOT : BootMode.BIOS_BOOT); }
}
public void CheckBIOSBootMode()
{
radioButtonBIOSBoot.Checked = true;
}
}
}