protected override AsyncAction CreateAction(out bool cancelled) { Program.AssertOnEventThread(); cancelled = false; AsyncAction action = null; using (PropertiesDialog propertiesDialog = new PropertiesDialog(VM)) { propertiesDialog.SelectVMCPUEditPage(); propertiesDialog.FormClosing += (s, ee) => { if (propertiesDialog.DialogResult == DialogResult.Yes && ee.Action != null) { ee.StartAction = false; action = ee.Action; } }; propertiesDialog.ShowDialog(Program.MainWindow); if (propertiesDialog.DialogResult != DialogResult.Yes || action == null) cancelled = true; } return action; }
protected virtual void Execute(IXenObject xenObject) { using (PropertiesDialog dialog = new PropertiesDialog(xenObject)) { dialog.EditName(); dialog.ShowDialog(Parent); } }
protected override void Execute(IXenObject xenObject) { using (PropertiesDialog dialog = new PropertiesDialog(xenObject)) { dialog.EditDescription(); dialog.ShowDialog(Parent); } }
private void generateCustomFieldsBox() { List<CustomField> customFields = CustomFieldsManager.CustomFieldValues(xenObject); if (customFields.Count <= 0) return; PDSection s = pdSectionCustomFields; foreach (CustomField customField in customFields) { ToolStripMenuItem editValue = new ToolStripMenuItem(Messages.EDIT){Image= Properties.Resources.edit_16}; editValue.Click += delegate { using (PropertiesDialog dialog = new PropertiesDialog(xenObject)) { dialog.SelectCustomFieldsEditPage(); dialog.ShowDialog(); } }; var menuItems = new[] { editValue }; CustomFieldWrapper cfWrapper = new CustomFieldWrapper(xenObject, customField.Definition); s.AddEntry(customField.Definition.Name.Ellipsise(30), cfWrapper.ToString(), menuItems, customField.Definition.Name); } }
private void generateGeneralBox() { PDSection s = pdSectionGeneral; s.AddEntry(FriendlyName("host.name_label"), Helpers.GetName(xenObject), new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow, xenObject))); VM vm = xenObject as VM; if (vm == null || vm.DescriptionType != VM.VmDescriptionType.None) { s.AddEntry(FriendlyName("host.name_description"), xenObject.Description, new PropertiesToolStripMenuItem(new DescriptionPropertiesCommand(Program.MainWindow, xenObject))); } GenTagRow(s); GenFolderRow(s); if (xenObject is Host) { Host host = xenObject as Host; if (Helpers.GetPool(xenObject.Connection) != null) s.AddEntry(Messages.POOL_MASTER, host.IsMaster() ? Messages.YES : Messages.NO); if (!host.IsLive) { s.AddEntry(FriendlyName("host.enabled"), Messages.HOST_NOT_LIVE, Color.Red); } else if (!host.enabled) { var item = new ToolStripMenuItem(Messages.EXIT_MAINTENANCE_MODE); item.Click += delegate { new HostMaintenanceModeCommand(Program.MainWindow, host, HostMaintenanceModeCommandParameter.Exit).Execute(); }; s.AddEntry(FriendlyName("host.enabled"), host.MaintenanceMode ? Messages.HOST_IN_MAINTENANCE_MODE : Messages.DISABLED, new[] { item }, Color.Red); } else { var item = new ToolStripMenuItem(Messages.ENTER_MAINTENANCE_MODE); item.Click += delegate { new HostMaintenanceModeCommand(Program.MainWindow, host, HostMaintenanceModeCommandParameter.Enter).Execute(); }; s.AddEntry(FriendlyName("host.enabled"), Messages.YES, item); } s.AddEntry(FriendlyName("host.iscsi_iqn"), host.iscsi_iqn, new PropertiesToolStripMenuItem(new IqnPropertiesCommand(Program.MainWindow, xenObject))); s.AddEntry(FriendlyName("host.log_destination"), host.SysLogDestination ?? Messages.HOST_LOG_DESTINATION_LOCAL, new PropertiesToolStripMenuItem(new HostEditLogDestinationCommand(Program.MainWindow, xenObject))); PrettyTimeSpan uptime = host.Uptime; PrettyTimeSpan agentUptime = host.AgentUptime; s.AddEntry(FriendlyName("host.uptime"), uptime == null ? "" : host.Uptime.ToString()); s.AddEntry(FriendlyName("host.agentUptime"), agentUptime == null ? "" : host.AgentUptime.ToString()); if (host.external_auth_type == Auth.AUTH_TYPE_AD) s.AddEntry(FriendlyName("host.external_auth_service_name"), host.external_auth_service_name); } else if (xenObject is VM) { s.AddEntry(FriendlyName("VM.OSName"), vm.GetOSName()); s.AddEntry(FriendlyName("VM.OperatingMode"), vm.IsHVM ? Messages.VM_OPERATING_MODE_HVM : Messages.VM_OPERATING_MODE_PV); if (!vm.DefaultTemplate) { s.AddEntry(Messages.BIOS_STRINGS_COPIED, vm.BiosStringsCopied ? Messages.YES : Messages.NO); } if (vm.Connection != null) { var appl = vm.Connection.Resolve(vm.appliance); if (appl != null) { var applProperties = new ToolStripMenuItem(Messages.VM_APPLIANCE_PROPERTIES); applProperties.Click += (sender, e) => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }; s.AddEntryLink(Messages.VM_APPLIANCE, appl.Name, new[] { applProperties }, () => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }); } } if (vm.is_a_snapshot) { VM snapshotOf = vm.Connection.Resolve(vm.snapshot_of); s.AddEntry(Messages.SNAPSHOT_OF, snapshotOf == null ? string.Empty : snapshotOf.Name); s.AddEntry(Messages.CREATION_TIME, HelpersGUI.DateTimeToString(vm.snapshot_time.ToLocalTime() + vm.Connection.ServerTimeOffset, Messages.DATEFORMAT_DMY_HMS, true)); } if (!vm.is_a_template) { GenerateVirtualisationStatusForGeneralBox(s, vm); if (vm.RunningTime != null) s.AddEntry(FriendlyName("VM.uptime"), vm.RunningTime.ToString()); if (vm.IsP2V) { s.AddEntry(FriendlyName("VM.P2V_SourceMachine"), vm.P2V_SourceMachine); s.AddEntry(FriendlyName("VM.P2V_ImportDate"), HelpersGUI.DateTimeToString(vm.P2V_ImportDate.ToLocalTime(), Messages.DATEFORMAT_DMY_HMS, true)); } // Dont show if WLB is enabled. if (VMCanChooseHomeServer(vm)) { s.AddEntry(FriendlyName("VM.affinity"), vm.AffinityServerString, new PropertiesToolStripMenuItem(new VmEditHomeServerCommand(Program.MainWindow, xenObject)));} } } else if (xenObject is XenObject<SR>) { SR sr = xenObject as SR; s.AddEntry(Messages.TYPE, sr.FriendlyTypeName); if (sr.content_type != SR.Content_Type_ISO && sr.GetSRType(false) != SR.SRTypes.udev) { s.AddEntry(FriendlyName("SR.size"), sr.SizeString); /* DISABLED THIN PROVISIONING if (sr.type == "lvmohba" || sr.type == "lvmoiscsi") { // add entries related to thin lvhd SRs IEnumerable<CommandToolStripMenuItem> menuItems = null; if (!sr.IsThinProvisioned) { menuItems = new[] { new CommandToolStripMenuItem(new ConvertToThinSRCommand(Program.MainWindow, new List<SelectedItem>() { new SelectedItem(xenObject) }), true) }; } s.AddEntry(FriendlyName("SR.provisioning"), sr.IsThinProvisioned ? string.Format(Messages.SR_THIN_PROVISIONING_COMMITTED, sr.PercentageCommitted) : Messages.SR_THICK_PROVISIONING, menuItems); if(sr.IsThinProvisioned && sr.sm_config.ContainsKey("initial_allocation") && sr.sm_config.ContainsKey("allocation_quantum")) { s.AddEntry(FriendlyName("SR.disk-space-allocations"), Helpers.GetAllocationProperties(sr.sm_config["initial_allocation"], sr.sm_config["allocation_quantum"])); } } */ } if (sr.GetScsiID() != null) s.AddEntry(FriendlyName("SR.scsiid"), sr.GetScsiID() ?? Messages.UNKNOWN); // if in folder-view or if looking at SR on storagelink then display // location here if (Program.MainWindow.SelectionManager.Selection.HostAncestor == null && Program.MainWindow.SelectionManager.Selection.PoolAncestor == null) { IXenObject belongsTo = Helpers.GetPool(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.POOL, Helpers.GetName(belongsTo)); } else { belongsTo = Helpers.GetMaster(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.SERVER, Helpers.GetName(belongsTo)); } } } } else if (xenObject is XenObject<Pool>) { Pool p = xenObject as Pool; if (p != null) { s.AddEntry(Messages.POOL_LICENSE, p.LicenseString); if (Helpers.ClearwaterOrGreater(p.Connection)) s.AddEntry(Messages.NUMBER_OF_SOCKETS, p.CpuSockets.ToString()); var master = p.Connection.Resolve(p.master); if (master != null) { if (p.IsPoolFullyUpgraded) { s.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, master.ProductVersionText); } else { var cmd = new RollingUpgradeCommand(Program.MainWindow); var runRpuWizard = new ToolStripMenuItem(Messages.ROLLING_POOL_UPGRADE_ELLIPSIS, null, (sender, args) => cmd.Execute()); s.AddEntryLink(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, string.Format(Messages.POOL_VERSIONS_LINK_TEXT, master.ProductVersionText), new[] { runRpuWizard }, cmd); } } } } s.AddEntry(FriendlyName("host.uuid"), GetUUID(xenObject)); }
private void editPlacementPolicyButton_Click(object sender, System.EventArgs e) { var pool = Helpers.GetPoolOfOne(xenObject.Connection); using (PropertiesDialog propertiesDialog = new PropertiesDialog(pool)) { propertiesDialog.SelectPage(propertiesDialog.PoolGpuEditPage); propertiesDialog.ShowDialog(this); } }
private void archiveToolStripMenuItem_Click(object sender, EventArgs e) { var vmpp = VM.Connection.Resolve(VM.protection_policy); if (vmpp.archive_frequency != vmpp_archive_frequency.never) { var selectedSnapshots = GetSelectedSnapshots(); string text = ""; if (selectedSnapshots.Count == 1) text = string.Format(Messages.ARCHIVE_SNAPSHOT_NOW_TEXT_SINGLE, VM.Connection.Resolve(VM.protection_policy).archive_target_config_location); else text = string.Format(Messages.ARCHIVE_SNAPSHOT_NOW_TEXT_MULTIPLE, VM.Connection.Resolve(VM.protection_policy).archive_target_config_location); if (new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Information, text, Messages.ARCHIVE_VM_PROTECTION_TITLE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes) { foreach (var snapshot in selectedSnapshots) { new ArchiveNowAction(snapshot).RunAsync(); } } } else { if (new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Error, Messages.POLICY_DOES_NOT_HAVE_ARCHIVE, Messages.POLICY_DOES_NOT_HAVE_ARCHIVE_TITLE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes) { var dialog = new PropertiesDialog(vmpp); dialog.SelectNewPolicyArchivePage(); dialog.ShowDialog(this); } } }
private void propertiesButton_Click(object sender, EventArgs e) { VM snapshot = (VM)propertiesGroupBox.Tag; if (snapshot != null) { PropertiesDialog dialog = new PropertiesDialog(snapshot); dialog.ShowDialog(); } }
private void generateGeneralBox() { PDSection s = pdSectionGeneral; s.AddEntry(FriendlyName("host.name_label"), Helpers.GetName(xenObject), new PropertiesToolStripMenuItem(new PropertiesCommand(Program.MainWindow, xenObject))); if (!(xenObject is IStorageLinkObject)) { VM vm = xenObject as VM; if (vm == null || vm.DescriptionType != VM.VmDescriptionType.None) { s.AddEntry(FriendlyName("host.name_description"), xenObject.Description, new PropertiesToolStripMenuItem(new DescriptionPropertiesCommand(Program.MainWindow, xenObject))); } GenTagRow(s); GenFolderRow(s); } if (xenObject is Host) { Host host = xenObject as Host; if (Helpers.GetPool(xenObject.Connection) != null) s.AddEntry(Messages.POOL_MASTER, host.IsMaster() ? Messages.YES : Messages.NO); if (!host.IsLive) { s.AddEntry(FriendlyName("host.enabled"), Messages.HOST_NOT_LIVE, Color.Red); } else if (!host.enabled) { var item = new ToolStripMenuItem(Messages.EXIT_MAINTENANCE_MODE); item.Click += delegate { new HostMaintenanceModeCommand(Program.MainWindow, host, HostMaintenanceModeCommandParameter.Exit).Execute(); }; s.AddEntry(FriendlyName("host.enabled"), host.MaintenanceMode ? Messages.HOST_IN_MAINTENANCE_MODE : Messages.DISABLED, new[] { item }, Color.Red); } else { var item = new ToolStripMenuItem(Messages.ENTER_MAINTENANCE_MODE); item.Click += delegate { new HostMaintenanceModeCommand(Program.MainWindow, host, HostMaintenanceModeCommandParameter.Enter).Execute(); }; s.AddEntry(FriendlyName("host.enabled"), Messages.YES, item); } s.AddEntry(FriendlyName("host.iscsi_iqn"), host.iscsi_iqn, new PropertiesToolStripMenuItem(new IqnPropertiesCommand(Program.MainWindow, xenObject))); s.AddEntry(FriendlyName("host.log_destination"), host.SysLogDestination ?? Messages.HOST_LOG_DESTINATION_LOCAL, new PropertiesToolStripMenuItem(new HostEditLogDestinationCommand(Program.MainWindow, xenObject))); PrettyTimeSpan uptime = host.Uptime; PrettyTimeSpan agentUptime = host.AgentUptime; s.AddEntry(FriendlyName("host.uptime"), uptime == null ? "" : host.Uptime.ToString()); s.AddEntry(FriendlyName("host.agentUptime"), agentUptime == null ? "" : host.AgentUptime.ToString()); if ((Helpers.GeorgeOrGreater(xenObject.Connection) && host.external_auth_type == Auth.AUTH_TYPE_AD)) s.AddEntry(FriendlyName("host.external_auth_service_name"), host.external_auth_service_name); } else if (xenObject is VM) { VM vm = xenObject as VM; s.AddEntry(FriendlyName("VM.OSName"), vm.GetOSName()); s.AddEntry(FriendlyName("VM.OperatingMode"), vm.IsHVM ? Messages.VM_OPERATING_MODE_HVM : Messages.VM_OPERATING_MODE_PV); if (!vm.DefaultTemplate && Helpers.MidnightRideOrGreater(vm.Connection)) { s.AddEntry(Messages.BIOS_STRINGS_COPIED, vm.BiosStringsCopied ? Messages.YES : Messages.NO); } if (Helpers.BostonOrGreater(vm.Connection) && vm.Connection != null) { var appl = vm.Connection.Resolve(vm.appliance); if (appl != null) { var applProperties = new ToolStripMenuItem(Messages.VM_APPLIANCE_PROPERTIES); applProperties.Click += (sender, e) => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }; s.AddEntryLink(Messages.VM_APPLIANCE, appl.Name, new[] { applProperties }, () => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }); } } if (vm.is_a_snapshot) { VM snapshotOf = vm.Connection.Resolve(vm.snapshot_of); s.AddEntry(Messages.SNAPSHOT_OF, snapshotOf == null ? string.Empty : snapshotOf.Name); s.AddEntry(Messages.CREATION_TIME, HelpersGUI.DateTimeToString(vm.snapshot_time.ToLocalTime() + vm.Connection.ServerTimeOffset, Messages.DATEFORMAT_DMY_HMS, true)); } if (!vm.is_a_template) { GenerateVirtualisationStatusForGeneralBox(s, vm); if (vm.RunningTime != null) s.AddEntry(FriendlyName("VM.uptime"), vm.RunningTime.ToString()); if (vm.IsP2V) { s.AddEntry(FriendlyName("VM.P2V_SourceMachine"), vm.P2V_SourceMachine); s.AddEntry(FriendlyName("VM.P2V_ImportDate"), HelpersGUI.DateTimeToString(vm.P2V_ImportDate.ToLocalTime(), Messages.DATEFORMAT_DMY_HMS, true)); } // Dont show if WLB is enabled. if (VMCanChooseHomeServer(vm)) { s.AddEntry(FriendlyName("VM.affinity"), vm.AffinityServerString, new PropertiesToolStripMenuItem(new VmEditHomeServerCommand(Program.MainWindow, xenObject)));} } } else if (xenObject is XenObject<SR>) { SR sr = xenObject as SR; s.AddEntry(Messages.TYPE, sr.FriendlyTypeName); if (sr.content_type != SR.Content_Type_ISO && sr.GetSRType(false) != SR.SRTypes.udev) { s.AddEntry(FriendlyName("SR.size"), sr.SizeString); s.AddEntry(FriendlyName("SR.provisioning"), sr.IsThinProvisioned ? Messages.SR_THIN_PROVISIONING : Messages.SR_THICK_PROVISIONING); } if (sr.GetScsiID() != null) s.AddEntry(FriendlyName("SR.scsiid"), sr.GetScsiID() ?? Messages.UNKNOWN); // if in folder-view or if looking at SR on storagelink then display // location here if (Program.MainWindow.SelectionManager.Selection.HostAncestor == null && Program.MainWindow.SelectionManager.Selection.PoolAncestor == null) { IXenObject belongsTo = Helpers.GetPool(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.POOL, Helpers.GetName(belongsTo)); } else { belongsTo = Helpers.GetMaster(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.SERVER, Helpers.GetName(belongsTo)); } } } } else if (xenObject is XenObject<Pool>) { Pool p = xenObject as Pool; if (p != null) { s.AddEntry(Messages.POOL_LICENSE, p.LicenseString); if (Helpers.ClearwaterOrGreater(p.Connection)) s.AddEntry(Messages.NUMBER_OF_SOCKETS, p.CpuSockets.ToString()); var master = p.Connection.Resolve(p.master); if (master != null) { if (p.IsPoolFullyUpgraded) { s.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, master.ProductVersionText); } else { var cmd = new RollingUpgradeCommand(Program.MainWindow); var runRpuWizard = new ToolStripMenuItem(Messages.ROLLING_POOL_UPGRADE_ELLIPSIS, null, (sender, args) => cmd.Execute()); s.AddEntryLink(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, string.Format(Messages.POOL_VERSIONS_LINK_TEXT, master.ProductVersionText), new[] { runRpuWizard }, cmd); } } } } else if (xenObject is StorageLinkPool) { var pool = (StorageLinkPool)xenObject; string capacityText = Util.DiskSizeString(pool.Capacity * 1024L * 1024L); string usedSpaceText = Util.DiskSizeString(pool.UsedSpace * 1024L * 1024L); string text = string.Format(Messages.STORAGELINK_POOL_SIZE_USED, usedSpaceText, capacityText); s.AddEntry(Messages.SIZE, text); } else if (xenObject is StorageLinkServer) { StorageLinkServer server = (StorageLinkServer)xenObject; s.AddEntry(Messages.USERNAME, server.StorageLinkConnection.Username); string error = server.StorageLinkConnection.Error; if (!string.IsNullOrEmpty(error)) { s.AddEntry(Messages.ERROR, error); } } else if (xenObject is StorageLinkSystem) { StorageLinkSystem sys = (StorageLinkSystem)xenObject; s.AddEntry(Messages.FULL_NAME, sys.FullName); s.AddEntry(Messages.MODEL, sys.Model); s.AddEntry(Messages.SERIAL_NUMBER, sys.SerialNumber); } s.AddEntry(FriendlyName("host.uuid"), GetUUID(xenObject)); }
protected override void Execute(IXenObject xenObject) { using (PropertiesDialog dialog = new PropertiesDialog(xenObject)) { dialog.SelectLogDestinationEditPage(); dialog.ShowDialog(Parent); } }
protected override void Execute(IXenObject xenObject) { using (PropertiesDialog dialog = new PropertiesDialog(xenObject)) { dialog.SelectVdiSizeLocationPage(); dialog.ShowDialog(Parent); } }
private static void AddCustomFieldsToRow(IXenObject o, GridRow row) { foreach (CustomFieldDefinition customFieldDefinition in CustomFieldsManager.GetCustomFields()) { GridStringItem customFieldItem = new GridStringItem( new CustomFieldWrapper(o, customFieldDefinition), HorizontalAlignment.Center, VerticalAlignment.Middle, false, false, TextBrush, Program.DefaultFont, new EventHandler(delegate { using (PropertiesDialog dialog = new PropertiesDialog(o)) { dialog.SelectCustomFieldsEditPage(); dialog.ShowDialog(); } })); row.AddItem(CustomFieldsManager.CUSTOM_FIELD + customFieldDefinition.Name, customFieldItem); } }
private void generateGeneralBox() { PDSection s = pdSectionGeneral; s.AddEntry(FriendlyName("host.name_label"), Helpers.GetName(xenObject), new List<ToolStripMenuItem>(new ToolStripMenuItem[] { EditMenuItem("GeneralEditPage", "txtName") })); if (!(xenObject is IStorageLinkObject)) { VM vm = xenObject as VM; if (vm == null || vm.DescriptionType != VM.VmDescriptionType.None) { s.AddEntry(FriendlyName("host.name_description"), xenObject.Description, new List<ToolStripMenuItem>(new[] {EditMenuItem("GeneralEditPage", "txtDescription")})); } GenTagRow(s); GenFolderRow(s); } if (xenObject is Host) { Host host = xenObject as Host; if (Helpers.GetPool(xenObject.Connection) != null) s.AddEntry(Messages.POOL_MASTER, host.IsMaster() ? Messages.YES : Messages.NO); if (!host.IsLive) { s.AddEntry(FriendlyName("host.enabled"), Messages.HOST_NOT_LIVE, Color.Red); } else if (!host.enabled) { s.AddEntry(FriendlyName("host.enabled"), host.MaintenanceMode ? Messages.HOST_IN_MAINTENANCE_MODE : Messages.DISABLED, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { MainWindow.NewToolStripMenuItem(Messages.EXIT_MAINTENANCE_MODE, delegate(object sender, EventArgs e) { new HostMaintenanceModeCommand(Program.MainWindow.CommandInterface, host, HostMaintenanceModeCommandParameter.Exit).Execute(); }) }), Color.Red); } else { s.AddEntry(FriendlyName("host.enabled"), Messages.YES, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { MainWindow.NewToolStripMenuItem(Messages.ENTER_MAINTENANCE_MODE, delegate(object sender, EventArgs e) { new HostMaintenanceModeCommand(Program.MainWindow.CommandInterface, host, HostMaintenanceModeCommandParameter.Enter).Execute(); }) })); } s.AddEntry(FriendlyName("host.iscsi_iqn"), host.iscsi_iqn, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { EditMenuItem("GeneralEditPage", "txtIQN") })); s.AddEntry(FriendlyName("host.log_destination"), host.SysLogDestination ?? Messages.HOST_LOG_DESTINATION_LOCAL, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { EditMenuItem("LogDestinationEditPage", "localRadioButton") })); PrettyTimeSpan uptime = host.Uptime; PrettyTimeSpan agentUptime = host.AgentUptime; s.AddEntry(FriendlyName("host.uptime"), uptime == null ? "" : host.Uptime.ToString()); s.AddEntry(FriendlyName("host.agentUptime"), agentUptime == null ? "" : host.AgentUptime.ToString()); if ((Helpers.GeorgeOrGreater(xenObject.Connection) && host.external_auth_type == Auth.AUTH_TYPE_AD)) s.AddEntry(FriendlyName("host.external_auth_service_name"), host.external_auth_service_name); } else if (xenObject is VM) { VM vm = xenObject as VM; s.AddEntry(FriendlyName("VM.OSName"), vm.GetOSName()); if (!vm.DefaultTemplate && Helpers.MidnightRideOrGreater(vm.Connection)) { s.AddEntry(Messages.BIOS_STRINGS_COPIED, vm.BiosStringsCopied ? Messages.YES : Messages.NO); } if (Helpers.BostonOrGreater(vm.Connection) && vm.Connection != null) { var appl = vm.Connection.Resolve(vm.appliance); if (appl != null) { ToolStripMenuItem applProperties = MainWindow.NewToolStripMenuItem(Messages.VM_APPLIANCE_PROPERTIES, (sender, e) => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }); s.AddEntryLink(Messages.VM_APPLIANCE, appl.Name, new List<ToolStripMenuItem>(new[] { applProperties }), () => { using (PropertiesDialog propertiesDialog = new PropertiesDialog(appl)) propertiesDialog.ShowDialog(this); }); } } if (vm.is_a_snapshot) { VM snapshotOf = vm.Connection.Resolve(vm.snapshot_of); s.AddEntry(Messages.SNAPSHOT_OF, snapshotOf == null ? string.Empty : snapshotOf.Name); s.AddEntry(Messages.CREATION_TIME, HelpersGUI.DateTimeToString(vm.snapshot_time.ToLocalTime() + vm.Connection.ServerTimeOffset, Messages.DATEFORMAT_DMY_HMS, true)); } if (!vm.is_a_template) { if (vm.power_state == vm_power_state.Running) { if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED || vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE) { if (InstallToolsCommand.CanExecute(vm)) { ToolStripMenuItem installtools = MainWindow.NewToolStripMenuItem( Messages.INSTALL_XENSERVER_TOOLS_DOTS, delegate(object sender, EventArgs e) { new InstallToolsCommand(Program.MainWindow.CommandInterface, vm).Execute(); }); s.AddEntryLink(FriendlyName("VM.VirtualizationState"), vm.VirtualisationStatusString, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { installtools }), new InstallToolsCommand(Program.MainWindow.CommandInterface, vm)); } else { s.AddEntry(FriendlyName("VM.VirtualizationState"), vm.VirtualisationStatusString, Color.Red); } } else { s.AddEntry(FriendlyName("VM.VirtualizationState"), vm.VirtualisationStatusString); } } if (vm.RunningTime != null) s.AddEntry(FriendlyName("VM.uptime"), vm.RunningTime.ToString()); if (vm.IsP2V) { s.AddEntry(FriendlyName("VM.P2V_SourceMachine"), vm.P2V_SourceMachine); s.AddEntry(FriendlyName("VM.P2V_ImportDate"), HelpersGUI.DateTimeToString(vm.P2V_ImportDate.ToLocalTime(), Messages.DATEFORMAT_DMY_HMS, true)); } // Dont show if WLB is enabled. if (VMCanChooseHomeServer(vm)) { s.AddEntry(FriendlyName("VM.affinity"), vm.AffinityServerString, new List<ToolStripMenuItem>(new ToolStripMenuItem[] { EditMenuItem("HomeServerPage", "picker") })); } } } else if (xenObject is XenObject<SR>) { SR sr = xenObject as SR; s.AddEntry(Messages.TYPE, sr.FriendlyTypeName); if (sr.content_type != SR.Content_Type_ISO && sr.GetSRType(false) != SR.SRTypes.udev) s.AddEntry(FriendlyName("SR.size"), sr.SizeString); if (sr.GetScsiID() != null) s.AddEntry(FriendlyName("SR.scsiid"), sr.GetScsiID() ?? Messages.UNKNOWN); // if in folder-view or if looking at SR on storagelink then display // location here if (Program.MainWindow.SelectionManager.Selection.HostAncestor == null && Program.MainWindow.SelectionManager.Selection.PoolAncestor == null) { IXenObject belongsTo = Helpers.GetPool(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.POOL, Helpers.GetName(belongsTo)); } else { belongsTo = Helpers.GetMaster(sr.Connection); if (belongsTo != null) { s.AddEntry(Messages.SERVER, Helpers.GetName(belongsTo)); } } } } else if (xenObject is XenObject<Pool>) { Pool p = xenObject as Pool; if (p != null) { s.AddEntry(Messages.POOL_LICENSE, p.LicenseString); if (Helpers.ClearwaterOrGreater(p.Connection)) s.AddEntry(Messages.NUMBER_OF_SOCKETS, p.CpuSockets.ToString()); } } else if (xenObject is StorageLinkPool) { var pool = (StorageLinkPool)xenObject; string capacityText = Util.DiskSizeString(pool.Capacity * 1024L * 1024L); string usedSpaceText = Util.DiskSizeString(pool.UsedSpace * 1024L * 1024L); string text = string.Format(Messages.STORAGELINK_POOL_SIZE_USED, usedSpaceText, capacityText); s.AddEntry(Messages.SIZE, text); } else if (xenObject is StorageLinkServer) { StorageLinkServer server = (StorageLinkServer)xenObject; s.AddEntry(Messages.USERNAME, server.StorageLinkConnection.Username); string error = server.StorageLinkConnection.Error; if (!string.IsNullOrEmpty(error)) { s.AddEntry(Messages.ERROR, error); } } else if (xenObject is StorageLinkSystem) { StorageLinkSystem sys = (StorageLinkSystem)xenObject; s.AddEntry(Messages.FULL_NAME, sys.FullName); s.AddEntry(Messages.MODEL, sys.Model); s.AddEntry(Messages.SERIAL_NUMBER, sys.SerialNumber); } s.AddEntry(FriendlyName("host.uuid"), GetUUID(xenObject)); }
private void generateCustomFieldsBox() { List<CustomField> customFields = CustomFieldsManager.CustomFieldValues(xenObject); if (customFields.Count <= 0) return; PDSection s = pdSectionCustomFields; foreach (CustomField customField in customFields) { ToolStripMenuItem editValue = MainWindow.NewToolStripMenuItem(Messages.EDIT, Properties.Resources.edit_16, delegate(object sender, EventArgs e) { PropertiesDialog dialog = new PropertiesDialog(xenObject); dialog.SelectPage(dialog.CustomFieldsEditPage); dialog.ShowDialog(); }); List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>(); menuItems.Add(editValue); CustomFieldWrapper cfWrapper = new CustomFieldWrapper(xenObject, customField.Definition); s.AddEntry(customField.Definition.Name.Ellipsise(30), cfWrapper.ToString(), menuItems, customField.Definition.Name); } }
protected void Execute(IXenObject xenObject) { PropertiesDialog dialog = new PropertiesDialog(xenObject); dialog.SelectTab(_tab); dialog.SelectControl(_control); dialog.ShowDialog(Parent); }