Merge branch 'master' of git://hg.uk.xensource.com/carbon/trunk/xenadmin

This commit is contained in:
Mihaela Stoica 2013-12-06 10:24:58 +00:00
commit dfbce35d7c
25 changed files with 1096 additions and 716 deletions

View File

@ -115,14 +115,13 @@ namespace CFUValidator
SetupMocks(xenServerPatches, xenServerVersions);
Status = "Determining XenCenter update required...";
XenCenterUpdateAlert xcupdateAlert = XenAdmin.Core.Updates.NewXenCenterVersionAlert(xenCenterVersions, new Version(ServerVersion), false);
var xcupdateAlert = XenAdmin.Core.Updates.NewXenCenterUpdateAlert(xenCenterVersions, new Version(ServerVersion));
Status = "Determining XenServer update required...";
XenServerUpdateAlert updateAlert = XenAdmin.Core.Updates.NewServerVersionAlert(xenServerVersions, false);
var updateAlert = XenAdmin.Core.Updates.NewXenServerUpdateAlert(xenServerVersions);
Status = "Determining patches required...";
List<XenServerPatchAlert> patchAlerts = XenAdmin.Core.Updates.NewServerPatchesAlerts(xenServerVersions,
xenServerPatches, false);
var patchAlerts = XenAdmin.Core.Updates.NewXenServerPatchAlerts(xenServerVersions, xenServerPatches);
//Build patch checks list
List<AlertFeatureValidator> validators = new List<AlertFeatureValidator>
@ -147,7 +146,6 @@ namespace CFUValidator
xenServerVersions.ConvertAll(i=>i.Version.ToString()).Distinct().ToList().ForEach(v=>sb.AppendLine(v));
throw new CFUValidationException("Could not find the version in the check for updates file: " + ServerVersion + sb);
}
}
public string Output { get; private set; }

View File

@ -57,5 +57,26 @@ namespace XenAdmin.Alerts
a.AppliesTo.EscapeQuotes(),
date.EscapeQuotes());
}
public static string GetUpdateDetailsCSVQuotes(this Alert a)
{
string date = String.Empty;
string description = String.Empty;
Program.Invoke(Program.MainWindow, delegate
{
date = HelpersGUI.DateTimeToString(
a.Timestamp.ToLocalTime(),
Messages.DATEFORMAT_DMY_HM, true);
description = a.Description;
});
return String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\"",
a.Title.EscapeQuotes(),
description.EscapeQuotes(),
a.AppliesTo.EscapeQuotes(),
date.EscapeQuotes(),
a.WebPageLabel.EscapeQuotes());
}
}
}

View File

@ -118,13 +118,22 @@ namespace XenAdmin.Alerts
canIgnore = false;
}
public void IncludeHosts(List<Host> newHosts)
public void IncludeHosts(IEnumerable<Host> newHosts)
{
hosts.AddRange(newHosts);
if (hosts.Count > 0)
canIgnore = false;
}
public void CopyConnectionsAndHosts(XenServerPatchAlert alert)
{
connections.Clear();
connections.AddRange(alert.connections);
hosts.Clear();
hosts.AddRange(alert.hosts);
canIgnore = connections.Count == 0 && hosts.Count == 0;
}
public override string WebPageLabel
{
get

View File

@ -65,7 +65,7 @@ namespace XenAdmin.Alerts
canIgnore = false;
}
public void IncludeHosts(List<Host> newHosts)
public void IncludeHosts(IEnumerable<Host> newHosts)
{
hosts.AddRange(newHosts);
if (hosts.Count > 0)

View File

@ -154,7 +154,8 @@ namespace XenAdmin.Controls
});
}
Enabled = DropDownItems.Count > 0;
if (DropDownItems.Count <= 0)
Enabled = false;
}
finally
{
@ -384,6 +385,7 @@ namespace XenAdmin.Controls
{
toolStripMenuItemAll.Enabled = false;
InitializeHostList();
BuildFilterList();
}
else
{

View File

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using XenAdmin.Actions;
using XenAPI;
@ -45,74 +46,133 @@ namespace XenAdmin.Core
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static event Action<bool, string> CheckForUpdatesCompleted;
public static event Action CheckForUpdatesStarted;
public const string LastSeenServerVersionKey = "XenCenter.LastSeenServerVersion";
private static readonly List<Alert> updateAlerts = new List<Alert>();
public static List<Alert> UpdateAlerts
private static List<XenServerVersion> XenServerVersions = new List<XenServerVersion>();
private static List<XenServerPatch> XenServerPatches = new List<XenServerPatch>();
private static readonly object updateAlertsLock = new object();
private static readonly ChangeableList<Alert> updateAlerts = new ChangeableList<Alert>();
public static IEnumerable<Alert> UpdateAlerts
{
get { return updateAlerts; }
}
public static int UpdateAlertsCount
{
get { return updateAlerts.Count; }
}
private static void AddUpate(Alert update)
{
try
{
lock (updateAlertsLock)
updateAlerts.Add(update);
}
catch (Exception e)
{
log.Error("Failed to add update", e);
}
}
private static void RemoveUpdate(Alert update)
{
try
{
lock (updateAlertsLock)
updateAlerts.Remove(update);
}
catch (Exception e)
{
log.Error("Failed to remove update", e);
}
}
private static Alert FindUpdate(Alert alert)
{
lock (updateAlertsLock)
return FindUpdate(a => a.Equals(alert));
}
private static Alert FindUpdate(Predicate<Alert> predicate)
{
lock (updateAlertsLock)
return updateAlerts.Find(predicate);
}
private static void actionCompleted(ActionBase sender)
{
Program.AssertOffEventThread();
DownloadUpdatesXmlAction action = sender as DownloadUpdatesXmlAction;
bool succeeded = false;
DownloadUpdatesXmlAction action = sender as DownloadUpdatesXmlAction;
if (action == null)
return;
bool succeeded = action.Succeeded;
string errorMessage = string.Empty;
if (action != null)
{
succeeded = action.Succeeded;
lock (updateAlertsLock)
updateAlerts.Clear();
if (succeeded)
if (succeeded)
{
XenServerVersions = action.XenServerVersions;
XenServerPatches = action.XenServerPatches;
var xenCenterAlert = NewXenCenterUpdateAlert(action.XenCenterVersions, Program.Version);
if (xenCenterAlert != null)
updateAlerts.Add(xenCenterAlert);
var xenServerUpdateAlert = NewXenServerUpdateAlert(action.XenServerVersions);
if (xenServerUpdateAlert != null)
updateAlerts.Add(xenServerUpdateAlert);
var xenServerPatchAlerts = NewXenServerPatchAlerts(action.XenServerVersions, action.XenServerPatches);
if (xenServerPatchAlerts != null)
{
var xenCenterAlert = NewXenCenterVersionAlert(action.XenCenterVersions, false);
if (xenCenterAlert != null)
updateAlerts.Add(xenCenterAlert);
var xenServerUpdateAlert = NewServerVersionAlert(action.XenServerVersions, false);
if (xenServerUpdateAlert != null)
updateAlerts.Add(xenServerUpdateAlert);
var xenServerPatchAlerts = NewServerPatchesAlerts(action.XenServerVersions, action.XenServerPatches, false);
if (xenServerPatchAlerts != null)
foreach (var xenServerPatchAlert in xenServerPatchAlerts)
updateAlerts.Add(xenServerPatchAlert);
}
}
else
{
if (action.Exception != null)
{
if (action.Exception is System.Net.Sockets.SocketException)
{
foreach (var xenServerPatchAlert in xenServerPatchAlerts)
updateAlerts.Add(xenServerPatchAlert);
errorMessage = Messages.AVAILABLE_UPDATES_NETWORK_ERROR;
}
else
{
// Clean up and remove excess newlines, carriage returns, trailing nonsense
string errorText = action.Exception.Message.Trim();
errorText = System.Text.RegularExpressions.Regex.Replace(errorText, @"\r\n+", "");
errorMessage = string.Format(Messages.AVAILABLE_UPDATES_ERROR, errorText);
}
}
else
{
if (action.Exception != null)
{
if (action.Exception is System.Net.Sockets.SocketException)
{
errorMessage = Messages.AVAILABLE_UPDATES_NETWORK_ERROR;
}
else
{
// Clean up and remove excess newlines, carriage returns, trailing nonsense
string errorText = action.Exception.Message.Trim();
errorText = System.Text.RegularExpressions.Regex.Replace(errorText, @"\r\n+", "");
errorMessage = string.Format(Messages.AVAILABLE_UPDATES_ERROR, errorText);
}
}
if (string.IsNullOrEmpty(errorMessage))
{
errorMessage = Messages.AVAILABLE_UPDATES_INTERNAL_ERROR;
}
}
if (string.IsNullOrEmpty(errorMessage))
errorMessage = Messages.AVAILABLE_UPDATES_INTERNAL_ERROR;
}
if (CheckForUpdatesCompleted != null)
CheckForUpdatesCompleted(succeeded, errorMessage);
}
public static void RegisterCollectionChanged(CollectionChangeEventHandler handler)
{
updateAlerts.CollectionChanged += handler;
}
public static void DeregisterCollectionChanged(CollectionChangeEventHandler handler)
{
updateAlerts.CollectionChanged -= handler;
}
private static bool AllowUpdates
{
get
@ -123,47 +183,41 @@ namespace XenAdmin.Core
Properties.Settings.Default.AllowPatchesUpdates);
}
}
public static void CheckForUpdates()
/// <summary>
/// If AutomaticCheck is enabled it checks for updates regardless the
/// value of the parameter force. If AutomaticCheck is disabled it only
/// checks if force is true.
/// </summary>
public static void CheckForUpdates(bool force)
{
if (!AllowUpdates && !force)
return;
if (Helpers.CommonCriteriaCertificationRelease)
return;
DownloadUpdatesXmlAction action = new DownloadUpdatesXmlAction();
action.Completed += actionCompleted;
if (CheckForUpdatesStarted != null)
CheckForUpdatesStarted();
action.RunAsync();
}
public static void AutomaticCheckForUpdates()
{
if (!AllowUpdates)
return;
CheckForUpdates();
}
private static XenCenterVersion GetLatestPublishedXenCenterVersion(List<XenCenterVersion> xenCenterVersions, Version programVersion)
{
if (xenCenterVersions.Count == 0 || programVersion == new Version(0, 0, 0, 0))
return null;
List<XenCenterVersion> latest = new List<XenCenterVersion>();
foreach (XenCenterVersion v in xenCenterVersions)
if (v.IsLatest)
latest.Add(v);
var latest = from v in xenCenterVersions where v.IsLatest select v;
return latest.Find(xcv => xcv.Lang == Program.CurrentLanguage) ??
latest.Find(xcv => string.IsNullOrEmpty(xcv.Lang));
return latest.FirstOrDefault(xcv => xcv.Lang == Program.CurrentLanguage) ??
latest.FirstOrDefault(xcv => string.IsNullOrEmpty(xcv.Lang));
}
private static XenCenterUpdateAlert NewXenCenterVersionAlert(List<XenCenterVersion> xenCenterVersions,
bool checkAlertIsAlreadyDismissed)
{
return NewXenCenterVersionAlert(xenCenterVersions, Program.Version, checkAlertIsAlreadyDismissed);
}
public static XenCenterUpdateAlert NewXenCenterVersionAlert(List<XenCenterVersion> xenCenterVersions, Version currentProgramVersion,
bool checkAlertIsAlreadyDismissed)
public static XenCenterUpdateAlert NewXenCenterUpdateAlert(List<XenCenterVersion> xenCenterVersions, Version currentProgramVersion)
{
if (Helpers.CommonCriteriaCertificationRelease)
return null;
@ -173,12 +227,6 @@ namespace XenAdmin.Core
if (toUse == null)
return null;
if (checkAlertIsAlreadyDismissed && (toUse.VersionAndLang == Properties.Settings.Default.LatestXenCenterSeen))
{
log.Info(string.Format("Version {0} detected but already dismissed", toUse.VersionAndLang));
return null;
}
if (toUse.Version > currentProgramVersion ||
(toUse.Version == currentProgramVersion && toUse.Lang == Program.CurrentLanguage &&
!PropertyManager.IsCultureLoaded(Program.CurrentCulture)))
@ -191,14 +239,13 @@ namespace XenAdmin.Core
return null;
}
public static List<XenServerPatchAlert> NewServerPatchesAlerts(List<XenServerVersion> xenServerVersions,
List<XenServerPatch> xenServerPatches, bool checkAlertIsAlreadyDismissed)
public static List<XenServerPatchAlert> NewXenServerPatchAlerts(List<XenServerVersion> xenServerVersions,
List<XenServerPatch> xenServerPatches)
{
if (Helpers.CommonCriteriaCertificationRelease)
return null;
List<XenServerPatchAlert> alerts = GetServerPatchesAlerts(xenServerVersions, xenServerPatches,
checkAlertIsAlreadyDismissed);
var alerts = GetServerPatchAlerts(xenServerVersions, xenServerPatches);
return alerts.Where(alert => !alert.CanIgnore).ToList();
}
@ -214,8 +261,8 @@ namespace XenAdmin.Core
return alert;
}
private static List<XenServerPatchAlert> GetServerPatchesAlerts(List<XenServerVersion> xenServerVersions,
List<XenServerPatch> xenServerPatches, bool checkAlertIsAlreadyDismissed)
private static List<XenServerPatchAlert> GetServerPatchAlerts(List<XenServerVersion> xenServerVersions,
List<XenServerPatch> xenServerPatches)
{
List<XenServerPatchAlert> alerts = new List<XenServerPatchAlert>();
@ -252,23 +299,10 @@ namespace XenAdmin.Core
foreach (XenServerPatch xenServerPatch in patches)
{
XenServerPatchAlert alert = GetServerPatchAlert(alerts, xenServerPatch);
if (checkAlertIsAlreadyDismissed && pool.other_config.ContainsKey(IgnorePatchAction.IgnorePatchKey))
{
List<string> ignorelist =
new List<string>(pool.other_config[IgnorePatchAction.IgnorePatchKey].Split(','));
if (ignorelist.Contains(xenServerPatch.Uuid))
{
// we dont want to show the alert
continue;
}
}
XenServerPatch serverPatch = xenServerPatch;
List<Host> noPatchHosts =
hosts.Where(host => !host.AppliedPatches().Any(patch => patch.uuid == serverPatch.Uuid)).ToList();
var noPatchHosts = hosts.Where(host => !host.AppliedPatches().Any(patch => patch.uuid == serverPatch.Uuid));
if (noPatchHosts.Count == hosts.Count)
if (noPatchHosts.Count() == hosts.Count)
alert.IncludeConnection(xenConnection);
else
alert.IncludeHosts(noPatchHosts);
@ -279,32 +313,15 @@ namespace XenAdmin.Core
return alerts;
}
private static List<string> GetLatestSeenVersion(Pool pool)
{
if (!pool.other_config.ContainsKey(LastSeenServerVersionKey))
return new List<string>();
return new List<string>(pool.other_config[LastSeenServerVersionKey].Split(','));
}
public static XenServerUpdateAlert NewServerVersionAlert(List<XenServerVersion> xenServerVersions,
bool checkAlertIsAlreadyDismissed)
public static XenServerUpdateAlert NewXenServerUpdateAlert(List<XenServerVersion> xenServerVersions)
{
if (Helpers.CommonCriteriaCertificationRelease)
return null;
List<XenServerVersion> latestVersions = xenServerVersions.FindAll(item => item.Latest);
if (latestVersions.Count == 0)
var latestVersion = xenServerVersions.FindAll(item => item.Latest).OrderByDescending(v => v.Version).FirstOrDefault();
if (latestVersion == null)
return null;
XenServerVersion latestVersion = latestVersions[0];
for (int i = 1; i < latestVersions.Count; i++)
{
XenServerVersion version = latestVersions[i];
if (version.Version > latestVersion.Version)
latestVersion = version;
}
XenServerUpdateAlert alert = new XenServerUpdateAlert(latestVersion);
foreach (IXenConnection xc in ConnectionsManager.XenConnectionsCopy)
@ -315,14 +332,9 @@ namespace XenAdmin.Core
if (master == null || pool == null)
continue;
//check if the latest version has been already dismissed
if (checkAlertIsAlreadyDismissed && GetLatestSeenVersion(pool).Contains(latestVersion.VersionAndOEM))
return null;
var outOfDateHosts = hosts.Where(host => new Version(Helpers.HostProductVersion(host)) < latestVersion.Version);
List<Host> outOfDateHosts =
hosts.Where(host => new Version(Helpers.HostProductVersion(host)) < latestVersion.Version).ToList();
if (outOfDateHosts.Count == hosts.Count)
if (outOfDateHosts.Count() == hosts.Count)
alert.IncludeConnection(xc);
else
alert.IncludeHosts(outOfDateHosts);
@ -333,5 +345,44 @@ namespace XenAdmin.Core
return alert;
}
public static void CheckServerVersion()
{
if (!AllowUpdates || !Properties.Settings.Default.AllowXenServerUpdates)
return;
var alert = NewXenServerUpdateAlert(XenServerVersions);
if (alert == null)
return;
var existingAlert = FindUpdate(alert);
if (existingAlert != null && alert.CanIgnore)
RemoveUpdate(existingAlert);
else if (existingAlert != null)
((XenServerUpdateAlert)existingAlert).CopyConnectionsAndHosts(alert);
else if (!alert.CanIgnore)
AddUpate(alert);
}
public static void CheckServerPatches()
{
if (!AllowUpdates || !Properties.Settings.Default.AllowPatchesUpdates)
return;
var alerts = GetServerPatchAlerts(XenServerVersions, XenServerPatches);
foreach (var alert in alerts)
{
var existingAlert = FindUpdate(alert);
if (existingAlert != null && alert.CanIgnore)
RemoveUpdate(existingAlert);
else if (existingAlert != null)
((XenServerPatchAlert)existingAlert).CopyConnectionsAndHosts(alert);
else if (!alert.CanIgnore)
AddUpate(alert);
}
}
}
}

View File

@ -30,9 +30,9 @@ namespace XenAdmin
pluginManager.Dispose();
OtherConfigAndTagsWatcher.DeregisterEventHandlers();
ConnectionsManager.History.CollectionChanged -= History_CollectionChanged;
Alert.DeregisterAlertCollectionChanged(XenCenterAlerts_CollectionChanged);
XenAdmin.Core.Updates.DeregisterCollectionChanged(Updates_CollectionChanged);
XenCenterForm.ApplicationOpenFormsChanged -= XenCenterForm_ApplicationOpenFormsChanged;
ConnectionsManager.XenConnections.CollectionChanged -= XenConnection_CollectionChanged;
Program.StorageLinkConnections.CollectionChanged -= StorageLinkConnections_CollectionChanged;

View File

@ -194,10 +194,10 @@ namespace XenAdmin
pluginManager.LoadPlugins();
contextMenuBuilder = new ContextMenuBuilder(pluginManager, commandInterface);
updatesPage.UpdatesCollectionChanged += updatesPage_UpdatesCollectionChanged;
eventsPage.GoToXenObjectRequested += eventsPage_GoToXenObjectRequested;
SearchPage.SearchChanged += SearchPanel_SearchChanged;
Alert.RegisterAlertCollectionChanged(XenCenterAlerts_CollectionChanged);
Updates.RegisterCollectionChanged(Updates_CollectionChanged);
FormFontFixer.Fix(this);
@ -222,16 +222,15 @@ namespace XenAdmin
private void XenCenterForm_ApplicationOpenFormsChanged()
{
bool enabled = false;
foreach (Form form in Application.OpenForms)
{
if (form != this && form.Text != "" && !(form is ConnectingToServerDialog))
{
windowToolStripMenuItem.Enabled = true;
return;
}
enabled = true;
}
windowToolStripMenuItem.Enabled = false;
Program.BeginInvoke(this, () => { windowToolStripMenuItem.Enabled = enabled; });
}
private void Default_SettingChanging(object sender, SettingChangingEventArgs e)
@ -571,14 +570,14 @@ namespace XenAdmin
CheckForUpdatesTimer.Interval = 1000 * 60 * 60 * 24; // 24 hours
CheckForUpdatesTimer.Tick += CheckForUpdatesTimer_Tick;
CheckForUpdatesTimer.Start();
Updates.AutomaticCheckForUpdates();
Updates.CheckForUpdates(false);
}
ProcessCommand(CommandLineArgType, CommandLineParam);
}
private void CheckForUpdatesTimer_Tick(object sender, EventArgs e)
{
Updates.AutomaticCheckForUpdates();
Updates.CheckForUpdates(false);
}
private void LoadTasksAsMeddlingActions(IXenConnection connection)
@ -777,8 +776,6 @@ namespace XenAdmin
//CA-41228 refresh submenu items when there are no connections
SelectionManager.RefreshSelection();
}
// update ui
//XenAdmin.Settings.SaveServerList();
}
catch (Exception exn)
{
@ -874,6 +871,8 @@ namespace XenAdmin
if(licenseTimer != null)
licenseTimer.CheckActiveServerLicense(connection, false);
Updates.CheckServerPatches();
Updates.CheckServerVersion();
RequestRefreshTreeView();
}
@ -970,6 +969,9 @@ namespace XenAdmin
case "other_config":
// other_config may contain HideFromXenCenter
UpdateToolbars();
// other_config contains which patches to ignore
Updates.CheckServerPatches();
Updates.CheckServerVersion();
break;
case "name_label":
@ -1759,6 +1761,7 @@ namespace XenAdmin
{
var objectsView = rootNodeGrouping.Grouping as OrganizationViewObjects;
var vappsView = rootNodeGrouping.Grouping as OrganizationViewVapps;
var foldersView = rootNodeGrouping.Grouping as OrganizationViewFolders;
if (vappsView != null)
{
@ -1772,6 +1775,11 @@ namespace XenAdmin
SearchPage.Search = Search.SearchForNonVappGroup(gt.Grouping, gt.Parent, gt.Group);
}
else if (foldersView != null)
{
SearchPage.Search = Search.SearchForFolderGroup(rootNodeGrouping.Grouping,
rootNodeGrouping.Parent, rootNodeGrouping.Group);
}
else
{
SearchPage.Search = Search.SearchForNonVappGroup(rootNodeGrouping.Grouping,
@ -2420,15 +2428,19 @@ namespace XenAdmin
navigationPane.SelectObject(obj);
}
private void updatesPage_UpdatesCollectionChanged(int updatesCount)
private void Updates_CollectionChanged(object sender, CollectionChangeEventArgs e)
{
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Updates, updatesCount);
Program.Invoke(this, () =>
{
int updatesCount = Updates.UpdateAlertsCount;
navigationPane.UpdateNotificationsButton(NotificationsSubMode.Updates, updatesCount);
if (updatesPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Updates, updatesCount);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Updates, updatesCount);
}
if (updatesPage.Visible)
{
TitleLabel.Text = NotificationsSubModeItem.GetText(NotificationsSubMode.Updates, updatesCount);
TitleIcon.Image = NotificationsSubModeItem.GetImage(NotificationsSubMode.Updates, updatesCount);
}
});
}
private void CloseWhenActionsCanceled(object o)
@ -2686,9 +2698,7 @@ namespace XenAdmin
alertPage.RefreshAlertList();
if (updatesPage.Visible)
updatesPage.CheckForUpdates();
else
updatesPage.CancelUpdateCheck();
updatesPage.RefreshUpdateList();
if (eventsPage.Visible)
{

View File

@ -582,7 +582,7 @@ namespace XenAdmin.TabPages
toolStripDropDownSeveritiesFilter.Enabled =
toolStripDropDownButtonServerFilter.Enabled =
toolStripDropDownButtonDateFilter.Enabled =
toolStripButtonExportAll.Enabled = GridViewAlerts.Rows.Count > 0;
toolStripButtonExportAll.Enabled = Alert.NonDismissingAlertCount > 0;
// We use the nondismissing alert count here because we dont wan't to
// offer people the chance to dismiss alerts which are already being

View File

@ -64,6 +64,18 @@ namespace XenAdmin.TabPages
List<Host> hosts = new List<Host>();
List<VM> vms = new List<VM>();
private readonly CollectionChangeEventHandler Host_CollectionChangedWithInvoke;
//solution from: http://stackoverflow.com/questions/2612487/how-to-fix-the-flickering-in-user-controls
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
public IXenObject XenObject
{
set

View File

@ -276,7 +276,7 @@ namespace XenAdmin.TabPages
{
toolStripDdbFilterStatus.Enabled =
toolStripDdbFilterLocation.Enabled =
toolStripDdbFilterDates.Enabled = dataGridView.Rows.Count > 0;
toolStripDdbFilterDates.Enabled = ConnectionsManager.History.Count > 0;
tsmiDismissAll.Enabled = dataGridView.Rows.Cast<DataGridViewActionRow>().Any(row => row.Action.IsCompleted);
tsmiDismissSelected.Enabled = dataGridView.SelectedRows.Cast<DataGridViewActionRow>().Any(row => row.Action.IsCompleted);

View File

@ -15,6 +15,8 @@
{
if (disposing)
{
XenAdmin.Core.Updates.DeregisterCollectionChanged(UpdatesCollectionChanged);
XenAdmin.Core.Updates.CheckForUpdatesStarted -= CheckForUpdates_CheckForUpdatesStarted;
XenAdmin.Core.Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted;
if (components != null)
@ -31,21 +33,23 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ManageUpdatesPage));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.separatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.downloadAndInstallToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.refreshButton = new System.Windows.Forms.Button();
this.downloadAndInstallButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.informationLabelIcon = new System.Windows.Forms.PictureBox();
this.informationLabel = new System.Windows.Forms.LinkLabel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.toolStrip1 = new XenAdmin.Controls.ToolStripEx();
this.toolStripDropDownButtonServerFilter = new XenAdmin.Controls.FilterLocationToolStripDropDownButton();
this.toolStripDropDownButtonDateFilter = new XenAdmin.Controls.FilterDatesToolStripDropDownButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButtonRefresh = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButtonExportAll = new System.Windows.Forms.ToolStripButton();
this.toolStripLabelFiltersOnOff = new System.Windows.Forms.ToolStripLabel();
this.panelProgress = new XenAdmin.Controls.FlickerFreePanel();
this.labelProgress = new System.Windows.Forms.Label();
this.pictureBoxProgress = new System.Windows.Forms.PictureBox();
@ -54,56 +58,16 @@
this.ColumnMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnLocation = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnWebPage = new System.Windows.Forms.DataGridViewLinkColumn();
this.contextMenuStrip.SuspendLayout();
this.ColumnWebPage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.informationLabelIcon)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.panelProgress.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxProgress)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewUpdates)).BeginInit();
this.SuspendLayout();
//
// contextMenuStrip
//
this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.refreshToolStripMenuItem,
this.separatorToolStripMenuItem,
this.downloadAndInstallToolStripMenuItem});
this.contextMenuStrip.Name = "contextMenuStrip";
resources.ApplyResources(this.contextMenuStrip, "contextMenuStrip");
this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening);
//
// refreshToolStripMenuItem
//
this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
resources.ApplyResources(this.refreshToolStripMenuItem, "refreshToolStripMenuItem");
this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripMenuItem_Click);
//
// separatorToolStripMenuItem
//
this.separatorToolStripMenuItem.Name = "separatorToolStripMenuItem";
resources.ApplyResources(this.separatorToolStripMenuItem, "separatorToolStripMenuItem");
//
// downloadAndInstallToolStripMenuItem
//
this.downloadAndInstallToolStripMenuItem.Name = "downloadAndInstallToolStripMenuItem";
resources.ApplyResources(this.downloadAndInstallToolStripMenuItem, "downloadAndInstallToolStripMenuItem");
this.downloadAndInstallToolStripMenuItem.Click += new System.EventHandler(this.downloadAndInstallToolStripMenuItem_Click);
//
// refreshButton
//
resources.ApplyResources(this.refreshButton, "refreshButton");
this.refreshButton.Name = "refreshButton";
this.refreshButton.UseVisualStyleBackColor = true;
this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
//
// downloadAndInstallButton
//
resources.ApplyResources(this.downloadAndInstallButton, "downloadAndInstallButton");
this.downloadAndInstallButton.Name = "downloadAndInstallButton";
this.downloadAndInstallButton.UseVisualStyleBackColor = true;
this.downloadAndInstallButton.Click += new System.EventHandler(this.downloadAndInstallButton_Click);
//
// tableLayoutPanel1
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
@ -125,6 +89,74 @@
this.informationLabel.Name = "informationLabel";
this.informationLabel.TabStop = true;
//
// tableLayoutPanel2
//
resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2");
this.tableLayoutPanel2.BackColor = System.Drawing.Color.Gainsboro;
this.tableLayoutPanel2.Controls.Add(this.toolStrip1, 0, 0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
//
// toolStrip1
//
resources.ApplyResources(this.toolStrip1, "toolStrip1");
this.toolStrip1.BackColor = System.Drawing.Color.WhiteSmoke;
this.toolStrip1.ClickThrough = true;
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripDropDownButtonServerFilter,
this.toolStripDropDownButtonDateFilter,
this.toolStripSeparator3,
this.toolStripButtonRefresh,
this.toolStripSeparator1,
this.toolStripButtonExportAll,
this.toolStripLabelFiltersOnOff});
this.toolStrip1.Name = "toolStrip1";
//
// toolStripDropDownButtonServerFilter
//
this.toolStripDropDownButtonServerFilter.AutoToolTip = false;
resources.ApplyResources(this.toolStripDropDownButtonServerFilter, "toolStripDropDownButtonServerFilter");
this.toolStripDropDownButtonServerFilter.Margin = new System.Windows.Forms.Padding(2, 1, 0, 2);
this.toolStripDropDownButtonServerFilter.Name = "toolStripDropDownButtonServerFilter";
this.toolStripDropDownButtonServerFilter.FilterChanged += new System.Action(this.toolStripDropDownButtonServerFilter_FilterChanged);
//
// toolStripDropDownButtonDateFilter
//
this.toolStripDropDownButtonDateFilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
resources.ApplyResources(this.toolStripDropDownButtonDateFilter, "toolStripDropDownButtonDateFilter");
this.toolStripDropDownButtonDateFilter.Name = "toolStripDropDownButtonDateFilter";
this.toolStripDropDownButtonDateFilter.FilterChanged += new System.Action(this.toolStripDropDownButtonDateFilter_FilterChanged);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
//
// toolStripButtonRefresh
//
this.toolStripButtonRefresh.AutoToolTip = false;
resources.ApplyResources(this.toolStripButtonRefresh, "toolStripButtonRefresh");
this.toolStripButtonRefresh.Name = "toolStripButtonRefresh";
this.toolStripButtonRefresh.Click += new System.EventHandler(this.toolStripButtonRefresh_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
//
// toolStripButtonExportAll
//
this.toolStripButtonExportAll.AutoToolTip = false;
resources.ApplyResources(this.toolStripButtonExportAll, "toolStripButtonExportAll");
this.toolStripButtonExportAll.Name = "toolStripButtonExportAll";
this.toolStripButtonExportAll.Click += new System.EventHandler(this.toolStripButtonExportAll_Click);
//
// toolStripLabelFiltersOnOff
//
this.toolStripLabelFiltersOnOff.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
resources.ApplyResources(this.toolStripLabelFiltersOnOff, "toolStripLabelFiltersOnOff");
this.toolStripLabelFiltersOnOff.Name = "toolStripLabelFiltersOnOff";
//
// panelProgress
//
resources.ApplyResources(this.panelProgress, "panelProgress");
@ -159,15 +191,15 @@
this.ColumnLocation,
this.ColumnDate,
this.ColumnWebPage});
this.dataGridViewUpdates.ContextMenuStrip = this.contextMenuStrip;
this.dataGridViewUpdates.MultiSelect = true;
this.dataGridViewUpdates.Name = "dataGridViewUpdates";
this.dataGridViewUpdates.ReadOnly = true;
this.dataGridViewUpdates.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dataGridViewUpdates_SortCompare);
this.dataGridViewUpdates.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewUpdates_CellDoubleClick);
this.dataGridViewUpdates.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewUpdates_ColumnHeaderMouseClick);
this.dataGridViewUpdates.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewUpdates_CellClick);
this.dataGridViewUpdates.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridViewUpdates_KeyDown);
this.dataGridViewUpdates.SelectionChanged += new System.EventHandler(this.dataGridViewUpdates_SelectionChanged);
this.dataGridViewUpdates.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewUpdates_CellContentClick);
//
// ColumnExpand
//
@ -214,29 +246,29 @@
//
// ColumnWebPage
//
this.ColumnWebPage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.ColumnWebPage.FillWeight = 20F;
this.ColumnWebPage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
resources.ApplyResources(this.ColumnWebPage, "ColumnWebPage");
this.ColumnWebPage.Name = "ColumnWebPage";
this.ColumnWebPage.ReadOnly = true;
this.ColumnWebPage.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.ColumnWebPage.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.ColumnWebPage.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.ColumnWebPage.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// ManageUpdatesPage
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.tableLayoutPanel2);
this.Controls.Add(this.panelProgress);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.refreshButton);
this.Controls.Add(this.downloadAndInstallButton);
this.Controls.Add(this.dataGridViewUpdates);
this.Name = "ManageUpdatesPage";
this.contextMenuStrip.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.informationLabelIcon)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.panelProgress.ResumeLayout(false);
this.panelProgress.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxProgress)).EndInit();
@ -252,19 +284,22 @@
private XenAdmin.Controls.FlickerFreePanel panelProgress;
private System.Windows.Forms.PictureBox pictureBoxProgress;
private System.Windows.Forms.Label labelProgress;
private System.Windows.Forms.Button refreshButton;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem downloadAndInstallToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator separatorToolStripMenuItem;
private System.Windows.Forms.Button downloadAndInstallButton;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.PictureBox informationLabelIcon;
private System.Windows.Forms.LinkLabel informationLabel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private XenAdmin.Controls.ToolStripEx toolStrip1;
private XenAdmin.Controls.FilterLocationToolStripDropDownButton toolStripDropDownButtonServerFilter;
private XenAdmin.Controls.FilterDatesToolStripDropDownButton toolStripDropDownButtonDateFilter;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton toolStripButtonRefresh;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton toolStripButtonExportAll;
private System.Windows.Forms.ToolStripLabel toolStripLabelFiltersOnOff;
private System.Windows.Forms.DataGridViewImageColumn ColumnExpand;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnMessage;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnLocation;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDate;
private System.Windows.Forms.DataGridViewLinkColumn ColumnWebPage;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnWebPage;
}
}

View File

@ -36,260 +36,237 @@ using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using XenAdmin.Actions;
using XenAdmin.Alerts;
using XenAdmin.Controls;
using XenAdmin.Core;
using XenAdmin.Dialogs;
using XenAdmin.Network;
using XenAdmin.Wizards.PatchingWizard;
using XenAPI;
using Timer = System.Windows.Forms.Timer;
using XenAdmin.Actions;
namespace XenAdmin.TabPages
{
public partial class ManageUpdatesPage : UserControl
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Maintain a list of all the objects we currently have events on for clearing out on rebuild
private List<IXenConnection> connectionsWithEvents = new List<IXenConnection>();
private List<Pool> poolsWithEvents = new List<Pool>();
private List<Host> hostsWithEvents = new List<Host>();
private int currentSpinningFrame;
private Timer spinningTimer = new Timer();
private ImageList imageList = new ImageList();
private bool checkForUpdatesSucceeded;
Dictionary<string, bool> expandedState = new Dictionary<string, bool>();
public event Action<int> UpdatesCollectionChanged;
private void CheckForUpdates_CheckForUpdatesCompleted(bool succeeded, string errorMessage)
{
Program.Invoke(this, delegate
{
refreshButton.Enabled = true;
spinningTimer.Stop();
checkForUpdatesSucceeded = succeeded;
int alertCount = 0;
if (checkForUpdatesSucceeded)
{
alertCount = Updates.UpdateAlerts.Count;
if (alertCount > 0)
panelProgress.Visible = false;
else
{
pictureBoxProgress.Image = SystemIcons.Information.ToBitmap();
labelProgress.Text = Messages.AVAILABLE_UPDATES_NOT_FOUND;
}
Rebuild();
}
else
{
pictureBoxProgress.Image = SystemIcons.Error.ToBitmap();
labelProgress.Text = string.IsNullOrEmpty(errorMessage)
? Messages.AVAILABLE_UPDATES_NOT_FOUND
: errorMessage;
UpdateDownloadAndInstallButton(false);
}
if (UpdatesCollectionChanged != null)
UpdatesCollectionChanged(alertCount);
});
}
private List<string> selectedUpdates = new List<string>();
private int checksQueue;
public ManageUpdatesPage()
{
InitializeComponent();
InitializeProgressControls();
tableLayoutPanel1.Visible = false;
UpdateButtonEnablement();
dataGridViewUpdates.Sort(ColumnDate, ListSortDirection.Descending);
informationLabel.Click += informationLabel_Click;
Updates.RegisterCollectionChanged(UpdatesCollectionChanged);
Updates.CheckForUpdatesStarted += CheckForUpdates_CheckForUpdatesStarted;
Updates.CheckForUpdatesCompleted += CheckForUpdates_CheckForUpdatesCompleted;
}
public void CancelUpdateCheck()
public void RefreshUpdateList()
{
if (spinningTimer.Enabled)
{
spinningTimer.Stop();
panelProgress.Visible = false;
}
toolStripDropDownButtonServerFilter.InitializeHostList();
toolStripDropDownButtonServerFilter.BuildFilterList();
Rebuild();
}
private void informationLabel_Click(object sender, EventArgs e)
{
try
{
Process.Start(InvisibleMessages.UPSELL_SA);
}
catch (Exception)
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.LICENSE_SERVER_COULD_NOT_OPEN_LINK, InvisibleMessages.LICENSE_SERVER_DOWNLOAD_LINK),
Messages.XENCENTER)).ShowDialog(this);
}
}
private void connection_CachePopulated(object sender, EventArgs e)
private void UpdatesCollectionChanged(object sender, EventArgs e)
{
Program.Invoke(this, Rebuild);
}
private void RegisterEvents()
private void CheckForUpdates_CheckForUpdatesStarted()
{
foreach (IXenConnection c in ConnectionsManager.XenConnectionsCopy)
Program.Invoke(this, () =>
{
checksQueue++;
if (checksQueue > 1)
return;
toolStripButtonRefresh.Enabled = false;
StoreSelectedUpdates();
dataGridViewUpdates.Rows.Clear();
spinningTimer.Start();
panelProgress.Visible = true;
labelProgress.Text = Messages.AVAILABLE_UPDATES_SEARCHING;
});
}
private void CheckForUpdates_CheckForUpdatesCompleted(bool succeeded, string errorMessage)
{
Program.Invoke(this, delegate
{
checksQueue--;
toolStripButtonRefresh.Enabled = true;
spinningTimer.Stop();
if (succeeded)
{
int alertCount = Updates.UpdateAlertsCount;
if (alertCount > 0)
panelProgress.Visible = false;
else
{
pictureBoxProgress.Image = SystemIcons.Information.ToBitmap();
labelProgress.Text = Messages.AVAILABLE_UPDATES_NOT_FOUND;
}
Rebuild();
}
else
{
pictureBoxProgress.Image = SystemIcons.Error.ToBitmap();
labelProgress.Text = string.IsNullOrEmpty(errorMessage)
? Messages.AVAILABLE_UPDATES_NOT_FOUND
: errorMessage;
}
});
}
private void InitializeProgressControls()
{
imageList.ColorDepth = ColorDepth.Depth32Bit;
imageList.ImageSize = new Size(32, 32);
imageList.Images.AddRange(new Image[]
{
Properties.Resources.SpinningFrame0,
Properties.Resources.SpinningFrame1,
Properties.Resources.SpinningFrame2,
Properties.Resources.SpinningFrame3,
Properties.Resources.SpinningFrame4,
Properties.Resources.SpinningFrame5,
Properties.Resources.SpinningFrame6,
Properties.Resources.SpinningFrame7
});
spinningTimer.Tick += timer_Tick;
spinningTimer.Interval = 150;
}
private void timer_Tick(object sender, EventArgs e)
{
int imageIndex = ++currentSpinningFrame <= 7 ? currentSpinningFrame : currentSpinningFrame = 0;
pictureBoxProgress.Image = imageList.Images[imageIndex];
}
private void SetFilterLabel()
{
toolStripLabelFiltersOnOff.Text = FilterIsOn
? Messages.FILTERS_ON
: Messages.FILTERS_OFF;
}
private bool FilterIsOn
{
get
{
c.CachePopulated += connection_CachePopulated;
connectionsWithEvents.Add(c);
foreach (var pool in c.Cache.Pools)
{
pool.PropertyChanged += pool_PropertyChanged;
poolsWithEvents.Add(pool);
}
foreach (Host host in c.Cache.Hosts)
{
host.PropertyChanged += host_PropertyChanged;
hostsWithEvents.Add(host);
}
return toolStripDropDownButtonDateFilter.FilterIsOn ||
toolStripDropDownButtonServerFilter.FilterIsOn;
}
}
private void DeregisterEvents()
{
foreach (IXenConnection c in connectionsWithEvents)
c.CachePopulated -= connection_CachePopulated;
foreach (var pool in poolsWithEvents)
pool.PropertyChanged -= pool_PropertyChanged;
foreach (Host host in hostsWithEvents)
host.PropertyChanged -= host_PropertyChanged;
connectionsWithEvents.Clear();
hostsWithEvents.Clear();
poolsWithEvents.Clear();
}
private void host_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "name_label" || e.PropertyName == "metrics")
Program.Invoke(this, Rebuild);
}
private void pool_PropertyChanged(object obj, PropertyChangedEventArgs e)
{
if (e.PropertyName == "other_config" || e.PropertyName == "name_label")
Program.Invoke(this, Rebuild);
}
private void RefreshEventHandlers()
{
DeregisterEvents();
RegisterEvents();
}
private void Rebuild()
{
Program.AssertOnEventThread();
if (!checkForUpdatesSucceeded)
if (checksQueue > 0)
return;
RefreshEventHandlers();
PopulateGrid();
}
private void PopulateGrid()
{
dataGridViewUpdates.SuspendLayout();
SetFilterLabel();
try
{
DataGridViewColumn sortedColumn = dataGridViewUpdates.SortedColumn;
ListSortDirection sortDirection = (dataGridViewUpdates.SortOrder == SortOrder.Descending)
? ListSortDirection.Descending
: ListSortDirection.Ascending;
dataGridViewUpdates.SuspendLayout();
Alert selectedAlert = null;
if (dataGridViewUpdates.SelectedRows.Count > 0)
selectedAlert = (Alert)dataGridViewUpdates.SelectedRows[0].Tag;
if (dataGridViewUpdates.RowCount > 0)
{
StoreSelectedUpdates();
dataGridViewUpdates.Rows.Clear();
}
dataGridViewUpdates.Rows.Clear();
if (Updates.UpdateAlerts.Count == 0)
var updates = new List<Alert>(Updates.UpdateAlerts);
if (updates.Count == 0)
{
panelProgress.Visible = true;
pictureBoxProgress.Image = SystemIcons.Information.ToBitmap();
labelProgress.Text = Messages.AVAILABLE_UPDATES_NOT_FOUND;
UpdateDownloadAndInstallButton(false);
return;
}
updates.RemoveAll(FilterAlert);
panelProgress.Visible = false;
foreach (var myAlert in Updates.UpdateAlerts)
dataGridViewUpdates.Rows.Add(NewUpdateRow(myAlert));
if (sortedColumn == null)
dataGridViewUpdates.Sort(ColumnDate, ListSortDirection.Descending);
else
dataGridViewUpdates.Sort(sortedColumn, sortDirection);
//restore selection
bool selectionRestored = false;
if (selectedAlert != null)
if (dataGridViewUpdates.SortedColumn != null)
{
foreach (DataGridViewRow row in dataGridViewUpdates.Rows)
{
if (selectedAlert.Equals((Alert) row.Tag))
{
row.Cells[ColumnWebPage.Index].Selected = true;
selectionRestored = true;
break;
}
}
if (dataGridViewUpdates.SortedColumn.Index == ColumnMessage.Index)
updates.Sort(Alert.CompareOnTitle);
else if (dataGridViewUpdates.SortedColumn.Index == ColumnDate.Index)
updates.Sort(Alert.CompareOnDate);
else if (dataGridViewUpdates.SortedColumn.Index == ColumnLocation.Index)
updates.Sort(Alert.CompareOnAppliesTo);
if (dataGridViewUpdates.SortOrder == SortOrder.Descending)
updates.Reverse();
}
//select first row if no selection
if (selectedAlert == null || !selectionRestored)
{
if (dataGridViewUpdates.Rows.Count > 0) dataGridViewUpdates.Rows[0].Cells[ColumnWebPage.Index].Selected = true;
}
var rowList = new List<DataGridViewRow>();
foreach (var myAlert in updates)
rowList.Add(NewUpdateRow(myAlert));
dataGridViewUpdates.Rows.AddRange(rowList.ToArray());
foreach (DataGridViewRow row in dataGridViewUpdates.Rows)
row.Selected = selectedUpdates.Contains(((Alert)row.Tag).uuid);
if (dataGridViewUpdates.SelectedRows.Count == 0 && dataGridViewUpdates.Rows.Count > 0)
dataGridViewUpdates.Rows[0].Selected = true;
}
finally
{
dataGridViewUpdates.ResumeLayout();
UpdateButtonEnablement();
}
UpdateDownloadAndInstallButton(true);
}
private void UpdateDownloadAndInstallButton(bool canEnable)
/// <summary>
/// Runs all the current filters on the alert to determine if it should be shown in the list or not.
/// </summary>
/// <param name="alert"></param>
private bool FilterAlert(Alert alert)
{
if (canEnable && (dataGridViewUpdates.SelectedRows.Count > 0))
{
XenServerPatchAlert alert = dataGridViewUpdates.SelectedRows[0].Tag as XenServerPatchAlert;
if (alert != null)
{
if(!alert.CanApply)
{
ShowInformationHelper(alert.CannotApplyReason);
downloadAndInstallButton.Enabled = false;
return;
}
bool hide = false;
Program.Invoke(this, () =>
hide = toolStripDropDownButtonDateFilter.HideByDate(alert.Timestamp.ToLocalTime())
|| toolStripDropDownButtonServerFilter.HideByLocation(alert.HostUuid));
return hide;
}
ShowInformationHelper(alert.CannotApplyReason);
downloadAndInstallButton.Enabled = !string.IsNullOrEmpty(alert.Patch.PatchUrl);
return;
}
}
downloadAndInstallButton.Enabled = false;
private void StoreSelectedUpdates()
{
selectedUpdates = (dataGridViewUpdates.SelectedRows.Cast<DataGridViewRow>().Select(
selectedRow => ((Alert)selectedRow.Tag).uuid)).ToList();
}
private void UpdateButtonEnablement()
{
toolStripDropDownButtonServerFilter.Enabled =
toolStripDropDownButtonDateFilter.Enabled =
toolStripButtonExportAll.Enabled = Updates.UpdateAlertsCount > 0;
}
private void ShowInformationHelper(string reason)
@ -307,107 +284,69 @@ namespace XenAdmin.TabPages
private DataGridViewRow NewUpdateRow(Alert alert)
{
DataGridViewImageCell expanderCell = new DataGridViewImageCell();
DataGridViewTextBoxCell messageCell = new DataGridViewTextBoxCell();
DataGridViewTextBoxCell appliesToCell = new DataGridViewTextBoxCell();
DataGridViewTextBoxCell dateCell = new DataGridViewTextBoxCell();
DataGridViewLinkCell webPageCell = new DataGridViewLinkCell();
DataGridViewRow newRow = new DataGridViewRow();
newRow.Tag = alert;
var expanderCell = new DataGridViewImageCell();
var appliesCell = new DataGridViewTextBoxCell();
var detailCell = new DataGridViewTextBoxCell();
var dateCell = new DataGridViewTextBoxCell();
var actionItems = GetAlertActionItems(alert);
var actionCell = new DataGridViewDropDownSplitButtonCell(actionItems.ToArray());
var newRow = new DataGridViewRow { Tag = alert, MinimumHeight = DataGridViewDropDownSplitButtonCell.MIN_ROW_HEIGHT };
// Set the detail cell content and expanding arrow
if (expandedState.ContainsKey(alert.uuid))
{
// show the expanded arrow and the body detail
expanderCell.Value = Properties.Resources.expanded_triangle;
messageCell.Value = String.Format("{0}\n\n{1}", alert.Title, alert.Description);
detailCell.Value = String.Format("{0}\n\n{1}", alert.Title, alert.Description);
}
else
{
// show the expand arrow and just the title
expanderCell.Value = Properties.Resources.contracted_triangle;
messageCell.Value = alert.Title;
detailCell.Value = alert.Title;
}
dateCell.Value = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY, true);
webPageCell.Value = alert.WebPageLabel;
appliesToCell.Value = alert.AppliesTo;
appliesCell.Value = alert.AppliesTo;
dateCell.Value = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true);
newRow.Cells.AddRange(expanderCell, detailCell, appliesCell, dateCell, actionCell);
newRow.Cells.AddRange(expanderCell, messageCell, appliesToCell, dateCell, webPageCell);
return newRow;
}
private void dataGridViewUpdates_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
private List<ToolStripItem> GetAlertActionItems(Alert alert)
{
Alert alert1 = (Alert)dataGridViewUpdates.Rows[e.RowIndex1].Tag;
Alert alert2 = (Alert)dataGridViewUpdates.Rows[e.RowIndex2].Tag;
var items = new List<ToolStripItem>();
if (e.Column.Index == ColumnMessage.Index)
var patchAlert = alert as XenServerPatchAlert;
if (patchAlert != null && patchAlert.CanApply && !string.IsNullOrEmpty(patchAlert.Patch.PatchUrl))
{
e.SortResult = Alert.CompareOnTitle(alert1, alert2);
e.Handled = true;
var download = new ToolStripMenuItem(Messages.UPDATES_DOWNLOAD_AND_INSTALL);
download.Click += ToolStripMenuItemDownload_Click;
items.Add(download);
}
else if (e.Column.Index == ColumnDate.Index)
if (!string.IsNullOrEmpty(alert.WebPageLabel))
{
e.SortResult = Alert.CompareOnDate(alert1, alert2);
e.Handled = true;
}
else if (e.Column.Index == ColumnWebPage.Index)
{
e.SortResult = Alert.CompareOnWebPage(alert1, alert2);
e.Handled = true;
}
else if (e.Column.Index == ColumnLocation.Index)
{
e.SortResult = Alert.CompareOnAppliesTo(alert1, alert2);
e.Handled = true;
var fix = new ToolStripMenuItem(alert.FixLinkText);
fix.Click += ToolStripMenuItemGoToWebPage_Click;
items.Add(fix);
}
if (items.Count > 0)
items.Add(new ToolStripSeparator());
var copy = new ToolStripMenuItem(Messages.COPY);
copy.Click += ToolStripMenuItemCopy_Click;
items.Add(copy);
return items;
}
private void InitializeProgressControls()
{
imageList.ColorDepth = ColorDepth.Depth32Bit;
imageList.ImageSize = new Size(32, 32);
imageList.Images.Add(Properties.Resources.SpinningFrame0);
imageList.Images.Add(Properties.Resources.SpinningFrame1);
imageList.Images.Add(Properties.Resources.SpinningFrame2);
imageList.Images.Add(Properties.Resources.SpinningFrame3);
imageList.Images.Add(Properties.Resources.SpinningFrame4);
imageList.Images.Add(Properties.Resources.SpinningFrame5);
imageList.Images.Add(Properties.Resources.SpinningFrame6);
imageList.Images.Add(Properties.Resources.SpinningFrame7);
#region Actions DropDown event handlers
spinningTimer.Tick += new EventHandler(timer_Tick);
spinningTimer.Interval = 150;
}
private int currentSpinningFrame = 0;
private void timer_Tick(object sender, EventArgs e)
{
int imageIndex = ++currentSpinningFrame <= 7 ? currentSpinningFrame : currentSpinningFrame = 0;
pictureBoxProgress.Image = imageList.Images[imageIndex];
}
private void refreshButton_Click(object sender, EventArgs e)
{
CheckForUpdates();
}
public void CheckForUpdates()
{
checkForUpdatesSucceeded = false;
refreshButton.Enabled = false;
dataGridViewUpdates.Rows.Clear();
UpdateDownloadAndInstallButton(false);
spinningTimer.Start();
panelProgress.Visible = true;
labelProgress.Text = Messages.AVAILABLE_UPDATES_SEARCHING;
Updates.CheckForUpdates();
}
private void OpenGoToWebsiteLink()
private void ToolStripMenuItemGoToWebPage_Click(object sender, EventArgs e)
{
if (dataGridViewUpdates.SelectedRows.Count > 0)
{
@ -417,7 +356,7 @@ namespace XenAdmin.TabPages
}
}
private void DownloadAndInstall()
private void ToolStripMenuItemDownload_Click(object sender, EventArgs e)
{
if (dataGridViewUpdates.SelectedRows.Count == 0)
return;
@ -464,59 +403,68 @@ namespace XenAdmin.TabPages
}
}
private void contextMenuStrip_Opening(object sender, CancelEventArgs e)
private void ToolStripMenuItemCopy_Click(object sender, EventArgs e)
{
bool refreshVisible = refreshButton.Enabled;
bool downloadAndInstallVisible = false;
Point pt = dataGridViewUpdates.PointToClient(new Point(contextMenuStrip.Left, contextMenuStrip.Top));
DataGridView.HitTestInfo info = dataGridViewUpdates.HitTest(pt.X, pt.Y);
if (info != null && info.RowIndex >= 0 && info.RowIndex < dataGridViewUpdates.Rows.Count)
{
DataGridViewRow row = dataGridViewUpdates.Rows[info.RowIndex];
if (row != null)
{
row.Selected = true;
downloadAndInstallVisible = downloadAndInstallButton.Enabled;
}
}
if (!refreshVisible && !downloadAndInstallVisible)
{
e.Cancel = true;
if (dataGridViewUpdates.SelectedRows.Count == 0)
return;
StringBuilder sb = new StringBuilder();
foreach (DataGridViewRow r in dataGridViewUpdates.SelectedRows)
{
Alert alert = (Alert)r.Tag;
sb.AppendLine(alert.GetUpdateDetailsCSVQuotes());
}
refreshToolStripMenuItem.Visible = refreshVisible;
separatorToolStripMenuItem.Visible = downloadAndInstallVisible;
downloadAndInstallToolStripMenuItem.Visible = downloadAndInstallVisible;
try
{
Clipboard.SetText(sb.ToString());
}
catch (Exception ex)
{
log.Error("Exception while trying to set clipboard text.", ex);
log.Error(ex, ex);
}
}
private void downloadAndInstallToolStripMenuItem_Click(object sender, EventArgs e)
{
DownloadAndInstall();
}
#endregion
private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{
CheckForUpdates();
}
#region DataGridView event handlers
private void dataGridViewUpdates_SelectionChanged(object sender, EventArgs e)
{
UpdateDownloadAndInstallButton(true);
string reason = null;
if (dataGridViewUpdates.SelectedRows.Count > 0)
{
var alert = dataGridViewUpdates.SelectedRows[0].Tag as XenServerPatchAlert;
if (alert != null)
reason = alert.CannotApplyReason;
}
ShowInformationHelper(reason);
}
private void downloadAndInstallButton_Click(object sender, EventArgs e)
private void dataGridViewUpdates_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
DownloadAndInstall();
if (dataGridViewUpdates.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.Automatic)
Rebuild();
}
private void dataGridViewUpdates_CellContentClick(object sender, DataGridViewCellEventArgs e)
/// <summary>
/// Handles the automatic sorting of the AlertsGridView for the non-string columns
/// </summary>
private void dataGridViewUpdates_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex == ColumnWebPage.Index)
OpenGoToWebsiteLink();
Alert alert1 = (Alert)dataGridViewUpdates.Rows[e.RowIndex1].Tag;
Alert alert2 = (Alert)dataGridViewUpdates.Rows[e.RowIndex2].Tag;
if (e.Column.Index == ColumnDate.Index)
{
int sortResult = DateTime.Compare(alert1.Timestamp, alert2.Timestamp);
e.SortResult = (dataGridViewUpdates.SortOrder == SortOrder.Descending) ? sortResult *= -1 : sortResult;
e.Handled = true;
}
}
private void dataGridViewUpdates_CellClick(object sender, DataGridViewCellEventArgs e)
@ -525,7 +473,7 @@ namespace XenAdmin.TabPages
if (e.ColumnIndex < 0 || e.RowIndex < 0 || e.ColumnIndex != ColumnExpand.Index)
return;
toggleExpandedState(e.RowIndex);
ToggleExpandedState(e.RowIndex);
}
private void dataGridViewUpdates_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
@ -533,7 +481,8 @@ namespace XenAdmin.TabPages
// If you click on the headers you can get -1 as the index.
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
toggleExpandedState(e.RowIndex);
ToggleExpandedState(e.RowIndex);
}
private void dataGridViewUpdates_KeyDown(object sender, KeyEventArgs e)
@ -543,10 +492,9 @@ namespace XenAdmin.TabPages
foreach (DataGridViewBand row in dataGridViewUpdates.SelectedRows)
{
Alert alert = (Alert)dataGridViewUpdates.Rows[row.Index].Tag;
if (!expandedState.ContainsKey(alert.uuid))
{
toggleExpandedState(row.Index);
}
ToggleExpandedState(row.Index);
}
}
else if (e.KeyCode == Keys.Left) // collapse all selected rows
@ -554,42 +502,145 @@ namespace XenAdmin.TabPages
foreach (DataGridViewBand row in dataGridViewUpdates.SelectedRows)
{
Alert alert = (Alert)dataGridViewUpdates.Rows[row.Index].Tag;
if (expandedState.ContainsKey(alert.uuid))
{
toggleExpandedState(row.Index);
}
ToggleExpandedState(row.Index);
}
}
else if (e.KeyCode == Keys.Enter) // toggle expanded state for all selected rows
{
foreach (DataGridViewBand row in dataGridViewUpdates.SelectedRows)
{
toggleExpandedState(row.Index);
}
ToggleExpandedState(row.Index);
}
}
/// <summary>
/// Toggles the row specified between the expanded and contracted state
/// </summary>
/// <param name="alert"></param>
/// <param name="RowIndex"></param>
private void toggleExpandedState(int RowIndex)
private void ToggleExpandedState(int rowIndex)
{
Alert alert = (Alert)dataGridViewUpdates.Rows[RowIndex].Tag;
Alert alert = (Alert)dataGridViewUpdates.Rows[rowIndex].Tag;
if (expandedState.ContainsKey(alert.uuid))
{
expandedState.Remove(alert.uuid);
dataGridViewUpdates.Rows[RowIndex].Cells[ColumnMessage.Index].Value = alert.Title;
dataGridViewUpdates.Rows[RowIndex].Cells[ColumnExpand.Index].Value = Properties.Resources.contracted_triangle;
dataGridViewUpdates.Rows[rowIndex].Cells[ColumnMessage.Index].Value = alert.Title;
dataGridViewUpdates.Rows[rowIndex].Cells[ColumnExpand.Index].Value = Properties.Resources.contracted_triangle;
}
else
{
expandedState.Add(alert.uuid, true);
dataGridViewUpdates.Rows[RowIndex].Cells[ColumnMessage.Index].Value
= String.Format("{0}\n\n{1}", alert.Title, alert.Description);
dataGridViewUpdates.Rows[RowIndex].Cells[ColumnExpand.Index].Value = Properties.Resources.expanded_triangle;
dataGridViewUpdates.Rows[rowIndex].Cells[ColumnMessage.Index].Value
= string.Format("{0}\n\n{1}", alert.Title, alert.Description);
dataGridViewUpdates.Rows[rowIndex].Cells[ColumnExpand.Index].Value = Properties.Resources.expanded_triangle;
}
}
#endregion
#region Top ToolStripButtons event handlers
private void toolStripDropDownButtonDateFilter_FilterChanged()
{
Rebuild();
}
private void toolStripDropDownButtonServerFilter_FilterChanged()
{
Rebuild();
}
private void toolStripButtonRefresh_Click(object sender, EventArgs e)
{
Updates.CheckForUpdates(true);
}
private void toolStripButtonExportAll_Click(object sender, EventArgs e)
{
bool exportAll = true;
if (FilterIsOn)
{
using (var dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, Messages.UPDATE_EXPORT_ALL_OR_FILTERED),
new ThreeButtonDialog.TBDButton(Messages.ALERT_EXPORT_ALL_BUTTON, DialogResult.Yes),
new ThreeButtonDialog.TBDButton(Messages.ALERT_EXPORT_FILTERED_BUTTON, DialogResult.No, ThreeButtonDialog.ButtonType.NONE),
ThreeButtonDialog.ButtonCancel))
{
var result = dlog.ShowDialog(this);
if (result == DialogResult.No)
exportAll = false;
else if (result == DialogResult.Cancel)
return;
}
}
string fileName;
using (SaveFileDialog dialog = new SaveFileDialog
{
AddExtension = true,
Filter = string.Format("{0} (*.csv)|*.csv|{1} (*.*)|*.*",
Messages.CSV_DESCRIPTION, Messages.ALL_FILES),
FilterIndex = 0,
Title = Messages.EXPORT_ALL,
RestoreDirectory = true,
DefaultExt = "csv",
CheckPathExists = false,
OverwritePrompt = true
})
{
if (dialog.ShowDialog(this) != DialogResult.OK)
return;
fileName = dialog.FileName;
}
new DelegatedAsyncAction(null,
string.Format(Messages.EXPORT_UPDATES, fileName),
string.Format(Messages.EXPORTING_UPDATES, fileName),
string.Format(Messages.EXPORTED_UPDATES, fileName),
delegate
{
using (StreamWriter stream = new StreamWriter(fileName, false, UTF8Encoding.UTF8))
{
stream.WriteLine("{0},{1},{2},{3},{4}", Messages.TITLE,
Messages.DESCRIPTION, Messages.APPLIES_TO,
Messages.TIMESTAMP, Messages.WEB_PAGE);
if (exportAll)
{
foreach (Alert a in Updates.UpdateAlerts)
stream.WriteLine(a.GetUpdateDetailsCSVQuotes());
}
else
{
foreach (DataGridViewRow row in dataGridViewUpdates.Rows)
{
var a = row.Tag as Alert;
if (a != null)
stream.WriteLine(a.GetUpdateDetailsCSVQuotes());
}
}
}
}).RunAsync();
}
#endregion
private void informationLabel_Click(object sender, EventArgs e)
{
try
{
Process.Start(InvisibleMessages.UPSELL_SA);
}
catch (Exception)
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.LICENSE_SERVER_COULD_NOT_OPEN_LINK, InvisibleMessages.LICENSE_SERVER_DOWNLOAD_LINK),
Messages.XENCENTER)).ShowDialog(this);
}
}
}

View File

@ -117,108 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="refreshToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>184, 22</value>
</data>
<data name="refreshToolStripMenuItem.Text" xml:space="preserve">
<value>&amp;Refresh</value>
</data>
<data name="separatorToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>181, 6</value>
</data>
<data name="downloadAndInstallToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>184, 22</value>
</data>
<data name="downloadAndInstallToolStripMenuItem.Text" xml:space="preserve">
<value>&amp;Download &amp;&amp; Install...</value>
</data>
<data name="contextMenuStrip.Size" type="System.Drawing.Size, System.Drawing">
<value>185, 54</value>
</data>
<data name="&gt;&gt;contextMenuStrip.Name" xml:space="preserve">
<value>contextMenuStrip</value>
</data>
<data name="&gt;&gt;contextMenuStrip.Type" xml:space="preserve">
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="refreshButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="refreshButton.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="refreshButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="refreshButton.Location" type="System.Drawing.Point, System.Drawing">
<value>710, 382</value>
</data>
<data name="refreshButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="refreshButton.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="refreshButton.Text" xml:space="preserve">
<value>&amp;Refresh</value>
</data>
<data name="&gt;&gt;refreshButton.Name" xml:space="preserve">
<value>refreshButton</value>
</data>
<data name="&gt;&gt;refreshButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;refreshButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;refreshButton.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="downloadAndInstallButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="downloadAndInstallButton.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="downloadAndInstallButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="downloadAndInstallButton.Location" type="System.Drawing.Point, System.Drawing">
<value>565, 382</value>
</data>
<data name="downloadAndInstallButton.Size" type="System.Drawing.Size, System.Drawing">
<value>139, 23</value>
</data>
<data name="downloadAndInstallButton.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="downloadAndInstallButton.Text" xml:space="preserve">
<value>&amp;Download &amp;&amp; Install...</value>
</data>
<data name="&gt;&gt;downloadAndInstallButton.Name" xml:space="preserve">
<value>downloadAndInstallButton</value>
</data>
<data name="&gt;&gt;downloadAndInstallButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;downloadAndInstallButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;downloadAndInstallButton.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="tableLayoutPanel1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left, Right</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="informationLabelIcon.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
@ -312,6 +219,153 @@
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="informationLabelIcon" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="informationLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="tableLayoutPanel2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="tableLayoutPanel2.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="tableLayoutPanel2.ColumnCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1, 1</value>
</metadata>
<data name="toolStrip1.AutoSize" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="toolStrip1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="toolStrip1.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripDropDownButtonServerFilter.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripDropDownButtonServerFilter.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripDropDownButtonServerFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 23</value>
</data>
<data name="toolStripDropDownButtonServerFilter.Text" xml:space="preserve">
<value>Filter by Lo&amp;cation</value>
</data>
<data name="toolStripDropDownButtonDateFilter.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripDropDownButtonDateFilter.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripDropDownButtonDateFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 23</value>
</data>
<data name="toolStripDropDownButtonDateFilter.Text" xml:space="preserve">
<value>Filter by D&amp;ate</value>
</data>
<data name="toolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 26</value>
</data>
<data name="toolStripButtonRefresh.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripButtonRefresh.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripButtonRefresh.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 23</value>
</data>
<data name="toolStripButtonRefresh.Text" xml:space="preserve">
<value>&amp;Refresh</value>
</data>
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 26</value>
</data>
<data name="toolStripButtonExportAll.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripButtonExportAll.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripButtonExportAll.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 23</value>
</data>
<data name="toolStripButtonExportAll.Text" xml:space="preserve">
<value>E&amp;xport All</value>
</data>
<data name="toolStripLabelFiltersOnOff.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="toolStripLabelFiltersOnOff.Size" type="System.Drawing.Size, System.Drawing">
<value>104, 23</value>
</data>
<data name="toolStripLabelFiltersOnOff.Text" xml:space="preserve">
<value>Filters are ON/OFF</value>
</data>
<data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>1, 1</value>
</data>
<data name="toolStrip1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>1, 1, 1, 0</value>
</data>
<data name="toolStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>774, 26</value>
</data>
<data name="toolStrip1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="toolStrip1.Text" xml:space="preserve">
<value>toolStrip1</value>
</data>
<data name="&gt;&gt;toolStrip1.Name" xml:space="preserve">
<value>toolStrip1</value>
</data>
<data name="&gt;&gt;toolStrip1.Type" xml:space="preserve">
<value>XenAdmin.Controls.ToolStripEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;toolStrip1.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;toolStrip1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="tableLayoutPanel2.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="tableLayoutPanel2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<data name="tableLayoutPanel2.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="tableLayoutPanel2.RowCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="tableLayoutPanel2.Size" type="System.Drawing.Size, System.Drawing">
<value>776, 27</value>
</data>
<data name="tableLayoutPanel2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.Name" xml:space="preserve">
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tableLayoutPanel2.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="toolStrip1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,100" /&gt;&lt;Rows Styles="Absolute,27" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="panelProgress.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
@ -477,19 +531,25 @@
<value>True</value>
</metadata>
<data name="ColumnWebPage.HeaderText" xml:space="preserve">
<value>Web Page</value>
<value>Actions</value>
</data>
<data name="ColumnWebPage.MinimumWidth" type="System.Int32, mscorlib">
<value>100</value>
<value>30</value>
</data>
<data name="ColumnWebPage.Width" type="System.Int32, mscorlib">
<value>53</value>
</data>
<data name="dataGridViewUpdates.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 9pt</value>
</data>
<data name="dataGridViewUpdates.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
<value>12, 51</value>
</data>
<data name="dataGridViewUpdates.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 12, 0, 12</value>
</data>
<data name="dataGridViewUpdates.Size" type="System.Drawing.Size, System.Drawing">
<value>773, 355</value>
<value>776, 316</value>
</data>
<data name="dataGridViewUpdates.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
@ -504,7 +564,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;dataGridViewUpdates.ZOrder" xml:space="preserve">
<value>5</value>
<value>3</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
@ -521,23 +581,47 @@
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>800, 420</value>
</data>
<data name="&gt;&gt;refreshToolStripMenuItem.Name" xml:space="preserve">
<value>refreshToolStripMenuItem</value>
<data name="&gt;&gt;toolStripDropDownButtonServerFilter.Name" xml:space="preserve">
<value>toolStripDropDownButtonServerFilter</value>
</data>
<data name="&gt;&gt;refreshToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;toolStripDropDownButtonServerFilter.Type" xml:space="preserve">
<value>XenAdmin.Controls.FilterLocationToolStripDropDownButton, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;separatorToolStripMenuItem.Name" xml:space="preserve">
<value>separatorToolStripMenuItem</value>
<data name="&gt;&gt;toolStripDropDownButtonDateFilter.Name" xml:space="preserve">
<value>toolStripDropDownButtonDateFilter</value>
</data>
<data name="&gt;&gt;separatorToolStripMenuItem.Type" xml:space="preserve">
<data name="&gt;&gt;toolStripDropDownButtonDateFilter.Type" xml:space="preserve">
<value>XenAdmin.Controls.FilterDatesToolStripDropDownButton, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;toolStripSeparator3.Name" xml:space="preserve">
<value>toolStripSeparator3</value>
</data>
<data name="&gt;&gt;toolStripSeparator3.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;downloadAndInstallToolStripMenuItem.Name" xml:space="preserve">
<value>downloadAndInstallToolStripMenuItem</value>
<data name="&gt;&gt;toolStripButtonRefresh.Name" xml:space="preserve">
<value>toolStripButtonRefresh</value>
</data>
<data name="&gt;&gt;downloadAndInstallToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;toolStripButtonRefresh.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator1.Name" xml:space="preserve">
<value>toolStripSeparator1</value>
</data>
<data name="&gt;&gt;toolStripSeparator1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripButtonExportAll.Name" xml:space="preserve">
<value>toolStripButtonExportAll</value>
</data>
<data name="&gt;&gt;toolStripButtonExportAll.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripLabelFiltersOnOff.Name" xml:space="preserve">
<value>toolStripLabelFiltersOnOff</value>
</data>
<data name="&gt;&gt;toolStripLabelFiltersOnOff.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnExpand.Name" xml:space="preserve">
<value>ColumnExpand</value>
@ -567,7 +651,7 @@
<value>ColumnWebPage</value>
</data>
<data name="&gt;&gt;ColumnWebPage.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewLinkColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>ManageUpdatesPage</value>

View File

@ -113,7 +113,9 @@ namespace XenAdmin.Wizards.ImportWizard
foreach (VirtualSystem_Type vsType in ((VirtualSystemCollection_Type)envelopeType.Item).Content)
{
VirtualHardwareSection_Type vhs = OVF.FindVirtualHardwareSectionByAffinity(envelopeType, vsType.id, "xen");
list.AddRange(vhs.VirtualSystemOtherConfigurationData.Where(s => s.Name == "vgpu"));
var data = vhs.VirtualSystemOtherConfigurationData;
if (data != null)
list.AddRange(vhs.VirtualSystemOtherConfigurationData.Where(s => s.Name == "vgpu"));
}
return list;

View File

@ -77,16 +77,16 @@ namespace XenAdmin.Wizards.ImportWizard
{
get
{
if(rasd.ElementName == null)
return null;
return rasd.ElementName.Value;
return rasd.ElementName == null ? null : rasd.ElementName.Value;
}
}
public object Tag
{
get { return rasd.InstanceID.Value; }
get
{
return rasd.InstanceID == null ? null : rasd.InstanceID.Value;
}
}
public bool SRTypeInvalid

View File

@ -71,7 +71,7 @@ namespace XenAdmin.Wizards.ImportWizard
public string NetworkID
{
get { return rasd.InstanceID.Value; }
get { return rasd.InstanceID == null ? null : rasd.InstanceID.Value; }
}
}

View File

@ -12813,6 +12813,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Exported updates to {0}.
/// </summary>
public static string EXPORT_UPDATES {
get {
return ResourceManager.GetString("EXPORT_UPDATES", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Verify export on completion.
/// </summary>
@ -12831,6 +12840,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Exported updates to {0}..
/// </summary>
public static string EXPORTED_UPDATES {
get {
return ResourceManager.GetString("EXPORTED_UPDATES", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exporting.
/// </summary>
@ -12849,6 +12867,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Exporting updates to {0}....
/// </summary>
public static string EXPORTING_UPDATES {
get {
return ResourceManager.GetString("EXPORTING_UPDATES", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exporting VMs....
/// </summary>
@ -29931,6 +29958,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to You have applied filters to the list of updates. Do you wish to export all updates from every connected server, or only the updates you have chosen to view?.
/// </summary>
public static string UPDATE_EXPORT_ALL_OR_FILTERED {
get {
return ResourceManager.GetString("UPDATE_EXPORT_ALL_OR_FILTERED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot remove an update which is applied to any servers..
/// </summary>
@ -30148,6 +30184,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Download and Install.
/// </summary>
public static string UPDATES_DOWNLOAD_AND_INSTALL {
get {
return ResourceManager.GetString("UPDATES_DOWNLOAD_AND_INSTALL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Install Update.
/// </summary>
@ -32551,6 +32596,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Web Page.
/// </summary>
public static string WEB_PAGE {
get {
return ResourceManager.GetString("WEB_PAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wednesday.
/// </summary>

View File

@ -4415,12 +4415,18 @@ Would you like to eject these ISOs before continuing?</value>
<data name="EXPORTED_SYSTEM_ALERTS" xml:space="preserve">
<value>Exported system alerts to {0}</value>
</data>
<data name="EXPORTED_UPDATES" xml:space="preserve">
<value>Exported updates to {0}.</value>
</data>
<data name="EXPORTING" xml:space="preserve">
<value>Exporting</value>
</data>
<data name="EXPORTING_SYSTEM_ALERTS" xml:space="preserve">
<value>Exporting system alerts to {0}...</value>
</data>
<data name="EXPORTING_UPDATES" xml:space="preserve">
<value>Exporting updates to {0}...</value>
</data>
<data name="EXPORTING_VMS" xml:space="preserve">
<value>Exporting VMs...</value>
</data>
@ -4526,6 +4532,9 @@ Would you like to eject these ISOs before continuing?</value>
<data name="EXPORT_SYSTEM_ALERTS" xml:space="preserve">
<value>Export system alerts to {0}</value>
</data>
<data name="EXPORT_UPDATES" xml:space="preserve">
<value>Exported updates to {0}</value>
</data>
<data name="EXPORT_VM_VERIFY_POST_INSTALL" xml:space="preserve">
<value>&amp;Verify export on completion</value>
</data>
@ -10427,6 +10436,9 @@ Verify that the file is a valid xensearch export.</value>
<data name="UPDATES_DIALOG_RESTART_VMS_ON_HOST" xml:space="preserve">
<value>After installing this update, all VMs on server '{0}' must be restarted.</value>
</data>
<data name="UPDATES_DOWNLOAD_AND_INSTALL" xml:space="preserve">
<value>Download and Install</value>
</data>
<data name="UPDATES_WIZARD" xml:space="preserve">
<value>Install Update</value>
</data>
@ -10642,6 +10654,9 @@ Check your settings and try again.</value>
<data name="UPDATES_WIZARD_TOOLS_CD" xml:space="preserve">
<value>VM '{0}' has the tools CD in its drive.</value>
</data>
<data name="UPDATE_EXPORT_ALL_OR_FILTERED" xml:space="preserve">
<value>You have applied filters to the list of updates. Do you wish to export all updates from every connected server, or only the updates you have chosen to view?</value>
</data>
<data name="UPDATE_MANAGER_CANNOT_REMOVE_APPLIED_PATCH" xml:space="preserve">
<value>Cannot remove an update which is applied to any servers.</value>
</data>
@ -11267,6 +11282,9 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
<data name="WARNING_DELETE_VD_MULTIPLE" xml:space="preserve">
<value>This will delete these virtual disks permanently, destroying any data on them.</value>
</data>
<data name="WEB_PAGE" xml:space="preserve">
<value>Web Page</value>
</data>
<data name="WEDNESDAY_LONG" xml:space="preserve">
<value>Wednesday</value>
</data>

View File

@ -624,39 +624,37 @@ namespace XenAdmin.XenSearch
public static Search SearchForTags()
{
var tagsQuery = new ListEmptyQuery<String>(PropertyNames.tags, false);
var groupQuery = new GroupQuery(new QueryFilter[] {tagsQuery}, GroupQuery.GroupQueryType.Or);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), groupQuery);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), tagsQuery);
return new Search(query, null, false, "", null, false);
}
public static Search SearchForFolders()
{
var foldersQuery = new NullQuery<Folder>(PropertyNames.folder, false);
var groupQuery = new GroupQuery(new QueryFilter[] { foldersQuery }, GroupQuery.GroupQueryType.Or);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), groupQuery);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), foldersQuery);
return new Search(query, null, false, "", null, false);
}
public static Search SearchForCustomFields()
{
var fieldsQuery = new BooleanQuery(PropertyNames.has_custom_fields, true);
var groupQuery = new GroupQuery(new QueryFilter[] { fieldsQuery }, GroupQuery.GroupQueryType.Or);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), groupQuery);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), fieldsQuery);
return new Search(query, null, false, "", null, false);
}
public static Search SearchForVapps()
{
var vAppsQuery = new BooleanQuery(PropertyNames.in_any_appliance, true);
var groupQuery = new GroupQuery(new QueryFilter[] { vAppsQuery }, GroupQuery.GroupQueryType.Or);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), groupQuery);
Query query = new Query(new QueryScope(ObjectTypes.AllIncFolders), vAppsQuery);
return new Search(query, null, false, "", null, false);
}
public static Search SearchForFolderGroup(Grouping grouping, object parent, object v)
{
return new Search(new Query(new QueryScope(ObjectTypes.AllIncFolders), grouping.GetSubquery(parent, v)),
grouping.GetSubgrouping(v), false, grouping.GetGroupName(v), "", false);
}
public static Search SearchForNonVappGroup(Grouping grouping, object parent, object v)
{
return new Search(new Query(new QueryScope(ObjectTypes.AllExcFolders), grouping.GetSubquery(parent, v)),

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.5456
// Runtime Version:2.0.50727.5472
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -838,5 +838,29 @@ namespace XenOvf.Properties {
return ((string)(this["xenVDIKey"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("vmw")]
public string VMwareNamespacePrefix {
get {
return ((string)(this["VMwareNamespacePrefix"]));
}
set {
this["VMwareNamespacePrefix"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://www.vmware/schema/ovf")]
public string VMwareNamespace {
get {
return ((string)(this["VMwareNamespace"]));
}
set {
this["VMwareNamespace"] = value;
}
}
}
}

View File

@ -288,5 +288,11 @@
<Setting Name="xenVDIKey" Type="System.String" Scope="Application">
<Value Profile="(Default)">vdi=</Value>
</Setting>
<Setting Name="VMwareNamespacePrefix" Type="System.String" Scope="User">
<Value Profile="(Default)">vmw</Value>
</Setting>
<Setting Name="VMwareNamespace" Type="System.String" Scope="User">
<Value Profile="(Default)">http://www.vmware/schema/ovf</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -311,7 +311,7 @@ namespace XenOvf.Utilities
EnvelopeType ovfEnv = null;
try
{
ovfEnv = Tools.DeserializeXml<EnvelopeType>(ovfxml);
ovfEnv = (EnvelopeType)Deserialize(ovfxml, typeof(EnvelopeType));
}
catch (Exception ex)
{
@ -323,28 +323,27 @@ namespace XenOvf.Utilities
foreach (XmlAttribute xa in ovfEnv.AnyAttr)
{
if (xa.Prefix.ToLower().Equals(Properties.Settings.Default.vmwNamespacePrefix) ||
xa.NamespaceURI.Equals(Properties.Settings.Default.vmwNameSpace))
xa.NamespaceURI.Equals(Properties.Settings.Default.vmwNameSpace) ||
xa.Prefix.ToLower() == Properties.Settings.Default.VMwareNamespacePrefix ||
xa.NamespaceURI == Properties.Settings.Default.VMwareNamespace)
{
isVmware = true;
break;
}
}
//always call the vc4 conversion; even if the ovf is newer the
//replacements in the method (if they happen) are harmless
//and the only cost is the re-deserialization of the xml
if (isVmware)
{
// If we have these then its a newer/valid OVF from VMWare.
if (ovfEnv.References == null && ovfEnv.Sections == null && ovfEnv.Item == null)
{
ovfEnv = Tools.LoadVmw40OvfXml(ovfxml);
}
}
ovfEnv = LoadVmw40OvfXml(ovfxml);
}
if (ovfEnv == null)
{
ovfEnv = LoadVmw35OvfXml(ovfxml);
Log.Error("Last Change Convert died.");
}
return ovfEnv;
}
/// <summary>
@ -551,18 +550,9 @@ namespace XenOvf.Utilities
[SecurityPermission(SecurityAction.LinkDemand)]
public static T LoadFileXml<T>(string filename)
{
return (T)DeserializeXml<T>(LoadFile(filename));
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="xmlstring"></param>
/// <returns></returns>
public static T DeserializeXml<T>(string xmlstring)
{
return (T)Tools.Deserialize(xmlstring, typeof(T));
return (T)Deserialize(LoadFile(filename), typeof(T));
}
#endregion
#region STREAM
@ -602,36 +592,38 @@ namespace XenOvf.Utilities
return isValid;
}
private static EnvelopeType LoadVmw40OvfXml(string xmldoc)
private static EnvelopeType LoadVmw40OvfXml(string ovfxml)
{
EnvelopeType vmwOvf = null;
//
if (string.IsNullOrEmpty(ovfxml))
return null;
// With what VMWare currently publishes with VC4, we need to update the XML
//
xmldoc = xmldoc.Replace("<References", "<ovf:References") .Replace("</References", "</ovf:References")
.Replace("<Section", "<ovf:Section") .Replace("</Section", "</ovf:Section")
.Replace("<Content", "<ovf:Content") .Replace("</Content", "</ovf:Content")
.Replace("<File", "<ovf:File") .Replace("</File", "</ovf:File")
.Replace("<Disk", "<ovf:Disk") .Replace("</Disk", "</ovf:Disk")
.Replace("<Info", "<ovf:Info") .Replace("</Info", "</ovf:Info")
.Replace("<Network", "<ovf:Network") .Replace("</Network", "</ovf:Network")
ovfxml = ovfxml.Replace("<References", "<ovf:References").Replace("</References", "</ovf:References")
.Replace("<Section", "<ovf:Section").Replace("</Section", "</ovf:Section")
.Replace("<Content", "<ovf:Content").Replace("</Content", "</ovf:Content")
.Replace("<File", "<ovf:File").Replace("</File", "</ovf:File")
.Replace("<Disk", "<ovf:Disk").Replace("</Disk", "</ovf:Disk")
.Replace("<Info", "<ovf:Info").Replace("</Info", "</ovf:Info")
.Replace("<Network", "<ovf:Network").Replace("</Network", "</ovf:Network")
.Replace("<Description", "<ovf:Description").Replace("</Description", "</ovf:Description")
.Replace("<License", "<ovf:License").Replace("</License", "</ovf:License")
.Replace("<System", "<ovf:System").Replace("</System", "</ovf:System")
.Replace("<rasd:InstanceId", "<rasd:InstanceID").Replace("</rasd:InstanceId", "</rasd:InstanceID")
.Replace("<Item", "<ovf:Item").Replace("</Item", "</ovf:Item");
vmwOvf = (EnvelopeType)Deserialize(xmldoc, typeof(EnvelopeType));
Log.Debug("LoadVmw40OvfXml leaving");
return vmwOvf;
EnvelopeType ovfEnv = (EnvelopeType)Deserialize(ovfxml, typeof(EnvelopeType));
Log.Debug("Finished LoadVmw40OvfXml");
return ovfEnv;
}
private static EnvelopeType LoadVmw35OvfXml(string xmldoc)
private static EnvelopeType LoadVmw35OvfXml(string ovfxml)
{
EnvelopeType vmwOvf = null;
//
if (string.IsNullOrEmpty(ovfxml))
return null;
// With what VMWare currently publishes with VC35, we need to update the XML
//
xmldoc = xmldoc.Replace(Properties.Settings.Default.vmwEnvelopeNamespace, Properties.Settings.Default.cimEnvelopeURI)
ovfxml = ovfxml.Replace(Properties.Settings.Default.vmwEnvelopeNamespace, Properties.Settings.Default.cimEnvelopeURI)
.Replace("<References", "<ovf:References").Replace("</References", "</ovf:References")
.Replace("<Section", "<ovf:Section").Replace("</Section", "</ovf:Section")
.Replace("<Content", "<ovf:Content").Replace("</Content", "</ovf:Content")
@ -645,13 +637,9 @@ namespace XenOvf.Utilities
.Replace("<rasd:InstanceId", "<rasd:InstanceID").Replace("</rasd:InstanceId", "</rasd:InstanceID")
.Replace("<Item", "<ovf:Item").Replace("</Item", "</ovf:Item");
vmwOvf = (EnvelopeType)Deserialize(xmldoc, typeof(EnvelopeType));
Log.Debug("LoadVmw35OvfXml leaving");
if (vmwOvf == null)
{
Log.Error("Last Change Convert died.");
}
return vmwOvf;
EnvelopeType ovfEnv = (EnvelopeType)Deserialize(ovfxml, typeof(EnvelopeType));
Log.Debug("Finished LoadVmw35OvfXml");
return ovfEnv;
}
private static XenMember[] DeserializeXenMembers(XenMember[] members)
{

View File

@ -4,7 +4,10 @@
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="XenOvf.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XenOvf.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<XenOvf.Properties.Settings>
<setting name="cimEnvelopeURI" serializeAs="String">
@ -299,4 +302,14 @@
</applicationSettings>
<startup>
</startup>
<userSettings>
<XenOvf.Properties.Settings>
<setting name="VMwareNamespacePrefix" serializeAs="String">
<value>vmw</value>
</setting>
<setting name="VMwareNamespace" serializeAs="String">
<value>http://www.vmware/schema/ovf</value>
</setting>
</XenOvf.Properties.Settings>
</userSettings>
</configuration>

View File

@ -1323,7 +1323,11 @@ namespace XenOvfTransport
gpuGroup = null;
vgpuType = null;
var datum = system.VirtualSystemOtherConfigurationData.FirstOrDefault(s => s.Name == "vgpu");
var data = system.VirtualSystemOtherConfigurationData;
if (data == null)
return;
var datum = data.FirstOrDefault(s => s.Name == "vgpu");
if (datum == null)
return;