mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-85971: Removed method selecting tab by name. Made all pages of VerticallyTabbedDialog private.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
d335372575
commit
3b25591d71
@ -30,6 +30,9 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
using XenAdmin.Commands;
|
||||
|
||||
using XenAPI;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Dialogs;
|
||||
@ -59,16 +62,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
return delegate
|
||||
{
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(Host))
|
||||
{
|
||||
dialog.SelectPage(dialog.GeneralEditPage);
|
||||
dialog.GeneralEditPage.txtIQN.Focus();
|
||||
dialog.GeneralEditPage.txtIQN.SelectAll();
|
||||
dialog.ShowDialog(Program.MainWindow);
|
||||
}
|
||||
};
|
||||
return () => new PropertiesCommand(Program.MainWindow.CommandInterface, Host, "txtIQN").Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ namespace XenAdmin.Commands
|
||||
/// <param name="mainWindow">The application main window.</param>
|
||||
/// <param name="selection">The selection context for the Command.</param>
|
||||
protected Command(IMainWindow mainWindow, SelectedItem selection)
|
||||
: this(mainWindow, new SelectedItem[] { selection })
|
||||
: this(mainWindow, new [] { selection })
|
||||
{
|
||||
}
|
||||
|
||||
@ -106,9 +106,9 @@ namespace XenAdmin.Commands
|
||||
/// Initializes a new instance of the <see cref="Command"/> class.
|
||||
/// </summary>
|
||||
/// <param name="mainWindow">The application main window.</param>
|
||||
/// <param name="selection">The selection context for the Command.</param>
|
||||
protected Command(IMainWindow mainWindow, IXenObject selection)
|
||||
: this(mainWindow, new SelectedItem(selection))
|
||||
/// <param name="xenObject">The selection context for the Command.</param>
|
||||
protected Command(IMainWindow mainWindow, IXenObject xenObject)
|
||||
: this(mainWindow, new SelectedItem(xenObject))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
|
||||
namespace XenAdmin.Commands
|
||||
{
|
||||
internal class PropertiesToolStripMenuItem : CommandToolStripMenuItem
|
||||
{
|
||||
public PropertiesToolStripMenuItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PropertiesToolStripMenuItem(PropertiesCommand cmd)
|
||||
: base(cmd, Messages.EDIT, Properties.Resources.edit_16)
|
||||
{ }
|
||||
}
|
||||
}
|
@ -48,14 +48,13 @@ namespace XenAdmin.Commands
|
||||
/// </summary>
|
||||
internal class PropertiesCommand : Command
|
||||
{
|
||||
private readonly string _tab = "GeneralEditPage";
|
||||
private readonly string _control = "txtName";
|
||||
protected string _control = "txtName";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this Command. The parameter-less constructor is required if
|
||||
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
|
||||
/// </summary>
|
||||
public PropertiesCommand()
|
||||
protected PropertiesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
@ -65,23 +64,24 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
|
||||
public PropertiesCommand(IMainWindow mainWindow, IXenObject xenObject)
|
||||
: base(mainWindow, new SelectedItem(xenObject))
|
||||
: base(mainWindow, xenObject)
|
||||
{
|
||||
}
|
||||
|
||||
public PropertiesCommand(IMainWindow mainWindow, IXenObject xenObject, string tab, string control)
|
||||
public PropertiesCommand(IMainWindow mainWindow, IXenObject xenObject, string control)
|
||||
: this(mainWindow, xenObject)
|
||||
{
|
||||
_tab = tab;
|
||||
_control = control;
|
||||
}
|
||||
|
||||
protected void Execute(IXenObject xenObject)
|
||||
protected virtual void Execute(IXenObject xenObject)
|
||||
{
|
||||
PropertiesDialog dialog = new PropertiesDialog(xenObject);
|
||||
dialog.SelectTab(_tab);
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectGeneralEditPage();
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
@ -121,29 +121,6 @@ namespace XenAdmin.Commands
|
||||
/// </summary>
|
||||
internal class VMPropertiesCommand : PropertiesCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this Command. The parameter-less constructor is required if
|
||||
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
|
||||
/// </summary>
|
||||
public VMPropertiesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public VMPropertiesCommand(IMainWindow mainWindow, IEnumerable<SelectedItem> selection)
|
||||
: base(mainWindow, selection)
|
||||
{
|
||||
}
|
||||
|
||||
public VMPropertiesCommand(IMainWindow mainWindow, VM vm)
|
||||
: base(mainWindow, vm)
|
||||
{
|
||||
}
|
||||
|
||||
public VMPropertiesCommand(IMainWindow mainWindow, VM vm, string tab, string control)
|
||||
: base(mainWindow, vm, tab, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
if (selection.Count == 1)
|
||||
@ -160,29 +137,6 @@ namespace XenAdmin.Commands
|
||||
/// </summary>
|
||||
internal class SRPropertiesCommand : PropertiesCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this Command. The parameter-less constructor is required if
|
||||
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
|
||||
/// </summary>
|
||||
public SRPropertiesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public SRPropertiesCommand(IMainWindow mainWindow, IEnumerable<SelectedItem> selection)
|
||||
: base(mainWindow, selection)
|
||||
{
|
||||
}
|
||||
|
||||
public SRPropertiesCommand(IMainWindow mainWindow, SR sr)
|
||||
: base(mainWindow, sr)
|
||||
{
|
||||
}
|
||||
|
||||
public SRPropertiesCommand(IMainWindow mainWindow, SR sr, string tab, string control)
|
||||
: base(mainWindow, sr, tab, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
if (selection.Count == 1)
|
||||
@ -212,16 +166,6 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
}
|
||||
|
||||
public PoolPropertiesCommand(IMainWindow mainWindow, Pool pool)
|
||||
: base(mainWindow, pool)
|
||||
{
|
||||
}
|
||||
|
||||
public PoolPropertiesCommand(IMainWindow mainWindow, Pool pool, string tab, string control)
|
||||
: base(mainWindow, pool, tab, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
Execute(selection[0].PoolAncestor);
|
||||
@ -258,16 +202,6 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
}
|
||||
|
||||
public HostPropertiesCommand(IMainWindow mainWindow, Host host)
|
||||
: base(mainWindow, host)
|
||||
{
|
||||
}
|
||||
|
||||
public HostPropertiesCommand(IMainWindow mainWindow, Host host, string tab, string control)
|
||||
: base(mainWindow, host, tab, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
Execute(selection[0].HostAncestor);
|
||||
@ -292,29 +226,6 @@ namespace XenAdmin.Commands
|
||||
/// </summary>
|
||||
internal class TemplatePropertiesCommand : PropertiesCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this Command. The parameter-less constructor is required if
|
||||
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
|
||||
/// </summary>
|
||||
public TemplatePropertiesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public TemplatePropertiesCommand(IMainWindow mainWindow, IEnumerable<SelectedItem> selection)
|
||||
: base(mainWindow, selection)
|
||||
{
|
||||
}
|
||||
|
||||
public TemplatePropertiesCommand(IMainWindow mainWindow, VM template)
|
||||
: base(mainWindow, template)
|
||||
{
|
||||
}
|
||||
|
||||
public TemplatePropertiesCommand(IMainWindow mainWindow, VM template, string tab, string control)
|
||||
: base(mainWindow, template, tab, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
if (selection.Count == 1)
|
||||
@ -326,4 +237,76 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal class VmEditStartupOptionsCommand : PropertiesCommand
|
||||
{
|
||||
public VmEditStartupOptionsCommand(IMainWindow mainWindow, IXenObject xenObject, string control)
|
||||
: base(mainWindow, xenObject, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Execute(IXenObject xenObject)
|
||||
{
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectStartupOptionsEditPage();
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class VmEditHomeServerCommand : PropertiesCommand
|
||||
{
|
||||
public VmEditHomeServerCommand(IMainWindow mainWindow, IXenObject xenObject, string control)
|
||||
: base(mainWindow, xenObject, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Execute(IXenObject xenObject)
|
||||
{
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectHomeServerEditPage();
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class VmEditHaCommand : PropertiesCommand
|
||||
{
|
||||
public VmEditHaCommand(IMainWindow mainWindow, IXenObject xenObject, string control)
|
||||
: base(mainWindow, xenObject, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Execute(IXenObject xenObject)
|
||||
{
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectVMHAEditPage();
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class HostEditLogDestinationCommand : PropertiesCommand
|
||||
{
|
||||
public HostEditLogDestinationCommand(IMainWindow mainWindow, IXenObject xenObject, string control)
|
||||
: base(mainWindow, xenObject, control)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Execute(IXenObject xenObject)
|
||||
{
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectLogDestinationEditPage();
|
||||
dialog.SelectControl(_control);
|
||||
dialog.ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace XenAdmin.Controls
|
||||
|
||||
using (PropertiesDialog propertiesDialog = new PropertiesDialog(pool ?? xenObject))
|
||||
{
|
||||
propertiesDialog.SelectPage(propertiesDialog.PoolGpuEditPage);
|
||||
propertiesDialog.SelectPoolGpuEditPage();
|
||||
propertiesDialog.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
@ -593,9 +593,11 @@ namespace XenAdmin.Controls.XenSearch
|
||||
false, false, TextBrush, Program.DefaultFont,
|
||||
new EventHandler(delegate
|
||||
{
|
||||
PropertiesDialog dialog = new PropertiesDialog(o);
|
||||
dialog.SelectPage(dialog.CustomFieldsEditPage);
|
||||
dialog.ShowDialog();
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(o))
|
||||
{
|
||||
dialog.SelectCustomFieldsEditPage();
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
}));
|
||||
|
||||
row.AddItem(CustomFieldsManager.CUSTOM_FIELD + customFieldDefinition.Name, customFieldItem);
|
||||
|
@ -58,9 +58,11 @@ namespace XenAdmin.Dialogs
|
||||
Properties.Settings.Default.SeenAllowUpdatesDialog = true;
|
||||
if (checkBox1.Checked)
|
||||
{
|
||||
OptionsDialog dialog = new OptionsDialog(m_pluginManager);
|
||||
dialog.SelectTab("connectionOptionsPage1");
|
||||
dialog.ShowDialog(this);
|
||||
using (var dialog = new OptionsDialog(m_pluginManager))
|
||||
{
|
||||
dialog.SelectConnectionOptionsPage();
|
||||
dialog.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
Settings.TrySaveSettings();
|
||||
}
|
||||
|
2
XenAdmin/Dialogs/OptionsDialog.Designer.cs
generated
2
XenAdmin/Dialogs/OptionsDialog.Designer.cs
generated
@ -143,4 +143,4 @@ namespace XenAdmin.Dialogs
|
||||
private XenAdmin.Dialogs.OptionsPages.SaveAndRestoreOptionsPage saveAndRestoreOptionsPage1;
|
||||
private XenAdmin.Dialogs.OptionsPages.PluginOptionsPage pluginOptionsPage1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,11 @@ namespace XenAdmin.Dialogs
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public void SelectConnectionOptionsPage()
|
||||
{
|
||||
SelectPage(connectionOptionsPage1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,25 +48,25 @@ namespace XenAdmin.Dialogs
|
||||
public partial class PropertiesDialog : VerticallyTabbedDialog
|
||||
{
|
||||
#region Tabs
|
||||
public CPUMemoryEditPage VCpuMemoryEditPage;
|
||||
public HostMultipathPage hostMultipathPage1;
|
||||
public CustomFieldsDisplayPage CustomFieldsEditPage;
|
||||
public LogDestinationEditPage LogDestinationEditPage;
|
||||
public HomeServerEditPage HomeServerPage;
|
||||
public BootOptionsEditPage StartupOptionsEditPage;
|
||||
public VMAdvancedEditPage VMAdvancedEditPage;
|
||||
public PerfmonAlertEditPage PerfmonAlertEditPage;
|
||||
public EditNetworkPage editNetworkPage;
|
||||
public VDISizeLocationPage vdiSizeLocation;
|
||||
public VMHAEditPage VMHAEditPage;
|
||||
public GeneralEditPage GeneralEditPage;
|
||||
private CPUMemoryEditPage VCpuMemoryEditPage;
|
||||
private HostMultipathPage hostMultipathPage1;
|
||||
private CustomFieldsDisplayPage CustomFieldsEditPage;
|
||||
private LogDestinationEditPage LogDestinationEditPage;
|
||||
private HomeServerEditPage HomeServerPage;
|
||||
private BootOptionsEditPage StartupOptionsEditPage;
|
||||
private VMAdvancedEditPage VMAdvancedEditPage;
|
||||
private PerfmonAlertEditPage PerfmonAlertEditPage;
|
||||
private EditNetworkPage editNetworkPage;
|
||||
private VDISizeLocationPage vdiSizeLocation;
|
||||
private VMHAEditPage VMHAEditPage;
|
||||
private GeneralEditPage GeneralEditPage;
|
||||
private UpsellPage PerfmonAlertUpsellEditPage;
|
||||
private UpsellPage VMHAUpsellEditPage;
|
||||
private UpsellPage PerfmonAlertOptionsUpsellEditPage;
|
||||
public PerfmonAlertOptionsPage PerfmonAlertOptionsEditPage;
|
||||
public HostPowerONEditPage HostPowerONEditPage;
|
||||
public PoolPowerONEditPage PoolPowerONEditPage;
|
||||
public StorageLinkEditPage StorageLinkPage;
|
||||
private PerfmonAlertOptionsPage PerfmonAlertOptionsEditPage;
|
||||
private HostPowerONEditPage HostPowerONEditPage;
|
||||
private PoolPowerONEditPage PoolPowerONEditPage;
|
||||
private StorageLinkEditPage StorageLinkPage;
|
||||
private NewPolicySnapshotFrequencyPage newPolicySnapshotFrequencyPage1;
|
||||
private NewPolicySnapshotTypePage newPolicySnapshotTypePage1;
|
||||
private NewPolicyArchivePage newPolicyArchivePage1;
|
||||
@ -76,7 +76,7 @@ namespace XenAdmin.Dialogs
|
||||
private NewVMApplianceVMOrderAndDelaysPage newVmApplianceVmOrderAndDelaysPage1;
|
||||
private UpsellPage GpuUpsellEditPage;
|
||||
private GpuEditPage GpuEditPage;
|
||||
public PoolGpuEditPage PoolGpuEditPage;
|
||||
private PoolGpuEditPage PoolGpuEditPage;
|
||||
#endregion
|
||||
|
||||
private IXenObject xenObject, xenObjectBefore, xenObjectCopy;
|
||||
@ -492,7 +492,27 @@ namespace XenAdmin.Dialogs
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
#region Select Page methods
|
||||
#region Select page methods
|
||||
|
||||
public void SelectGeneralEditPage()
|
||||
{
|
||||
SelectPage(GeneralEditPage);
|
||||
}
|
||||
|
||||
public void SelectCustomFieldsEditPage()
|
||||
{
|
||||
SelectPage(CustomFieldsEditPage);
|
||||
}
|
||||
|
||||
public void SelectPoolGpuEditPage()
|
||||
{
|
||||
SelectPage(GpuEditPage);
|
||||
}
|
||||
|
||||
public void SelectStorageLinkPage()
|
||||
{
|
||||
SelectPage(StorageLinkPage);
|
||||
}
|
||||
|
||||
public void SelectPerfmonAlertEditPage()
|
||||
{
|
||||
@ -504,6 +524,26 @@ namespace XenAdmin.Dialogs
|
||||
SelectPage(newPolicyArchivePage1);
|
||||
}
|
||||
|
||||
public void SelectStartupOptionsEditPage()
|
||||
{
|
||||
SelectPage(StartupOptionsEditPage);
|
||||
}
|
||||
|
||||
public void SelectHomeServerEditPage()
|
||||
{
|
||||
SelectPage(HomeServerPage);
|
||||
}
|
||||
|
||||
public void SelectLogDestinationEditPage()
|
||||
{
|
||||
SelectPage(LogDestinationEditPage);
|
||||
}
|
||||
|
||||
public void SelectVMHAEditPage()
|
||||
{
|
||||
SelectPage(VMHAEditPage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -73,19 +73,7 @@ namespace XenAdmin.Dialogs
|
||||
get { return verticalTabs.SelectedItem as VerticalTabs.VerticalTab; }
|
||||
}
|
||||
|
||||
public void SelectTab(string name)
|
||||
{
|
||||
if (!ContentPanel.Controls.ContainsKey(name))
|
||||
return;
|
||||
|
||||
VerticalTabs.VerticalTab page = ContentPanel.Controls[name] as VerticalTabs.VerticalTab;
|
||||
if (page == null)
|
||||
return;
|
||||
|
||||
SelectPage(page);
|
||||
}
|
||||
|
||||
public void SelectPage(VerticalTabs.VerticalTab page)
|
||||
protected void SelectPage(VerticalTabs.VerticalTab page)
|
||||
{
|
||||
if (page == null || !verticalTabs.Items.Contains(page))
|
||||
return;
|
||||
@ -125,12 +113,12 @@ namespace XenAdmin.Dialogs
|
||||
return verticalTab != null ? verticalTab.Text : String.Empty;
|
||||
}
|
||||
|
||||
internal void SelectControl(String name)
|
||||
internal void SelectControl(string name)
|
||||
{
|
||||
SelectControlOfControl(ContentPanel, name);
|
||||
}
|
||||
|
||||
private bool SelectControlOfControl(Control c, String name)
|
||||
private bool SelectControlOfControl(Control c, string name)
|
||||
{
|
||||
if (c.Controls.ContainsKey(name))
|
||||
{
|
||||
|
@ -558,9 +558,11 @@ namespace XenAdmin.TabPages
|
||||
ToolStripMenuItem editValue = new ToolStripMenuItem(Messages.EDIT){Image= Properties.Resources.edit_16};
|
||||
editValue.Click += delegate
|
||||
{
|
||||
PropertiesDialog dialog = new PropertiesDialog(xenObject);
|
||||
dialog.SelectPage(dialog.CustomFieldsEditPage);
|
||||
dialog.ShowDialog();
|
||||
using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
|
||||
{
|
||||
dialog.SelectCustomFieldsEditPage();
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
};
|
||||
|
||||
var menuItems = new[] { editValue };
|
||||
@ -657,7 +659,7 @@ namespace XenAdmin.TabPages
|
||||
|
||||
PDSection s = pdSectionHighAvailability;
|
||||
|
||||
var menuItems = new[] { EditMenuItem("VMHAEditPage", "comboBoxProtectionLevel") };
|
||||
var menuItems = new[] { new PropertiesToolStripMenuItem(new VmEditHaCommand(Program.MainWindow.CommandInterface, xenObject, "comboBoxProtectionLevel")) };
|
||||
s.AddEntry(FriendlyName("VM.ha_restart_priority"), Helpers.RestartPriorityI18n(vm.HARestartPriority), menuItems);
|
||||
}
|
||||
|
||||
@ -892,18 +894,18 @@ namespace XenAdmin.TabPages
|
||||
if (!Helpers.BostonOrGreater(vm.Connection))
|
||||
{
|
||||
s.AddEntry(FriendlyName("VM.auto_boot"), Helpers.BoolToString(vm.AutoPowerOn),
|
||||
new[] { EditMenuItem("StartupOptionsEditPage", "ckbAutoBoot") });
|
||||
new[] { new PropertiesToolStripMenuItem(new VmEditStartupOptionsCommand(Program.MainWindow.CommandInterface, vm, "ckbAutoBoot")) });
|
||||
}
|
||||
|
||||
if (vm.IsHVM)
|
||||
{
|
||||
s.AddEntry(FriendlyName("VM.BootOrder"), HVMBootOrder(vm),
|
||||
new[] { EditMenuItem("StartupOptionsEditPage", "lstOrder") });
|
||||
new[] { new PropertiesToolStripMenuItem(new VmEditStartupOptionsCommand(Program.MainWindow.CommandInterface, vm, "lstOrder")) });
|
||||
}
|
||||
else
|
||||
{
|
||||
s.AddEntry(FriendlyName("VM.PV_args"), vm.PV_args,
|
||||
new[] { EditMenuItem("StartupOptionsEditPage", "txtOSParams") });
|
||||
new[] { new PropertiesToolStripMenuItem(new VmEditStartupOptionsCommand(Program.MainWindow.CommandInterface, vm, "txtOSParams")) });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1060,7 +1062,7 @@ namespace XenAdmin.TabPages
|
||||
PDSection s = pdSectionGeneral;
|
||||
|
||||
s.AddEntry(FriendlyName("host.name_label"), Helpers.GetName(xenObject),
|
||||
new [] { EditMenuItem("GeneralEditPage", "txtName") });
|
||||
new[] { new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject)) });
|
||||
|
||||
if (!(xenObject is IStorageLinkObject))
|
||||
{
|
||||
@ -1068,7 +1070,7 @@ namespace XenAdmin.TabPages
|
||||
if (vm == null || vm.DescriptionType != VM.VmDescriptionType.None)
|
||||
{
|
||||
s.AddEntry(FriendlyName("host.name_description"), xenObject.Description,
|
||||
new[] { EditMenuItem("GeneralEditPage", "txtDescription") });
|
||||
new[] { new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject, "txtDescription")) });
|
||||
}
|
||||
|
||||
GenTagRow(s);
|
||||
@ -1111,9 +1113,9 @@ namespace XenAdmin.TabPages
|
||||
}
|
||||
|
||||
s.AddEntry(FriendlyName("host.iscsi_iqn"), host.iscsi_iqn,
|
||||
new [] { EditMenuItem("GeneralEditPage", "txtIQN") });
|
||||
new[] { new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject, "txtIQN")) });
|
||||
s.AddEntry(FriendlyName("host.log_destination"), host.SysLogDestination ?? Messages.HOST_LOG_DESTINATION_LOCAL,
|
||||
new [] { EditMenuItem("LogDestinationEditPage", "localRadioButton") });
|
||||
new[] { new PropertiesToolStripMenuItem(new HostEditLogDestinationCommand(Program.MainWindow.CommandInterface, xenObject, "localRadioButton")) });
|
||||
|
||||
PrettyTimeSpan uptime = host.Uptime;
|
||||
PrettyTimeSpan agentUptime = host.AgentUptime;
|
||||
@ -1207,7 +1209,7 @@ namespace XenAdmin.TabPages
|
||||
if (VMCanChooseHomeServer(vm))
|
||||
{
|
||||
s.AddEntry(FriendlyName("VM.affinity"), vm.AffinityServerString,
|
||||
new[] { EditMenuItem("HomeServerPage", "picker") });
|
||||
new[] { new PropertiesToolStripMenuItem(new VmEditHomeServerCommand(Program.MainWindow.CommandInterface, xenObject, "picker")) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1400,11 +1402,11 @@ namespace XenAdmin.TabPages
|
||||
goToTag.DropDownItems.Add(item);
|
||||
}
|
||||
|
||||
s.AddEntry(Messages.TAGS, TagsString(), new[] { goToTag, EditMenuItem("GeneralEditPage", "") });
|
||||
s.AddEntry(Messages.TAGS, TagsString(), new[] { goToTag, new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject)) });
|
||||
return;
|
||||
}
|
||||
|
||||
s.AddEntry(Messages.TAGS, Messages.NONE, new[] { EditMenuItem("GeneralEditPage", "") });
|
||||
s.AddEntry(Messages.TAGS, Messages.NONE, new[] { new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject)) });
|
||||
}
|
||||
|
||||
private string TagsString()
|
||||
@ -1425,7 +1427,7 @@ namespace XenAdmin.TabPages
|
||||
item.Click += delegate { Program.MainWindow.SearchForFolder(xenObject.Path); };
|
||||
menuItems.Add(item);
|
||||
}
|
||||
menuItems.Add(EditMenuItem("GeneralEditPage", ""));
|
||||
menuItems.Add(new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject)));
|
||||
s.AddEntry(
|
||||
Messages.FOLDER,
|
||||
new FolderListItem(xenObject.Path, FolderListItem.AllowSearch.None, false),
|
||||
@ -1535,12 +1537,6 @@ namespace XenAdmin.TabPages
|
||||
|
||||
#endregion
|
||||
|
||||
private ToolStripMenuItem EditMenuItem(string tabname, string controlname)
|
||||
{
|
||||
return new CommandToolStripMenuItem(new PropertiesCommand(Program.MainWindow.CommandInterface, xenObject, tabname, controlname), Messages.EDIT, Properties.Resources.edit_16);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks for reboot warnings on all hosts in the pool and returns them as a list
|
||||
/// </summary>
|
||||
|
@ -642,7 +642,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
|
||||
if (o != null)
|
||||
{
|
||||
var dialog = new PropertiesDialog(o);
|
||||
dialog.Load += (s, ee) => dialog.SelectPage(dialog.StorageLinkPage);
|
||||
dialog.Load += (s, ee) => dialog.SelectStorageLinkPage();
|
||||
|
||||
dialog.FormClosing += (s, ee) =>
|
||||
{
|
||||
|
@ -119,6 +119,9 @@
|
||||
<Compile Include="Alerts\Types\MessageAlert.cs" />
|
||||
<Compile Include="Alerts\Types\XenServerPatchAlert.cs" />
|
||||
<Compile Include="Alerts\Types\XenServerUpdateAlert.cs" />
|
||||
<Compile Include="Commands\Controls\EditPropertiesToolStripMenuItem.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\AffinityPicker.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
Loading…
Reference in New Issue
Block a user