diff --git a/XenAdmin/Controls/NetworkingTab/NetworkList.cs b/XenAdmin/Controls/NetworkingTab/NetworkList.cs index 62dc98a5d..0a358ce04 100644 --- a/XenAdmin/Controls/NetworkingTab/NetworkList.cs +++ b/XenAdmin/Controls/NetworkingTab/NetworkList.cs @@ -305,8 +305,6 @@ namespace XenAdmin.Controls.NetworkingTab } NetworksGridView.Rows.AddRange(vifRowsToAdd.ToArray()); - bool selected = true; - if (selectedVIF != null) { foreach (VifRow row in NetworksGridView.Rows) @@ -319,11 +317,6 @@ namespace XenAdmin.Controls.NetworkingTab } } } - - if (!selected && NetworksGridView.Rows.Count > 0) - { - NetworksGridView.Rows[0].Selected = true; - } } else if (XenObject is Host || XenObject is Pool) { diff --git a/XenAdmin/TabPages/PvsPage.cs b/XenAdmin/TabPages/PvsPage.cs index 875ef8626..d7eee2122 100644 --- a/XenAdmin/TabPages/PvsPage.cs +++ b/XenAdmin/TabPages/PvsPage.cs @@ -231,17 +231,17 @@ namespace XenAdmin.TabPages { vm.PropertyChanged -= VmPropertyChanged; vm.PropertyChanged += VmPropertyChanged; - if (pvsProxy != null) - { - pvsProxy.PropertyChanged -= PvsProxyPropertyChanged; - pvsProxy.PropertyChanged += PvsProxyPropertyChanged; - PVS_site pvsSite = pvsProxy == null ? null : Connection.Resolve(pvsProxy.site); - if (pvsSite != null) - { - pvsSite.PropertyChanged -= PvsSitePropertyChanged; - pvsSite.PropertyChanged += PvsSitePropertyChanged; - } - } + + if (pvsProxy == null) + return; + pvsProxy.PropertyChanged -= PvsProxyPropertyChanged; + pvsProxy.PropertyChanged += PvsProxyPropertyChanged; + + var pvsSite = Connection.Resolve(pvsProxy.site); + if (pvsSite == null) + return; + pvsSite.PropertyChanged -= PvsSitePropertyChanged; + pvsSite.PropertyChanged += PvsSitePropertyChanged; } private void UnregisterVmEventHandlers() diff --git a/XenModel/Actions/DR/ShutdownAndDestroyVMsAction.cs b/XenModel/Actions/DR/ShutdownAndDestroyVMsAction.cs index c2e978dba..ab84fc2b2 100644 --- a/XenModel/Actions/DR/ShutdownAndDestroyVMsAction.cs +++ b/XenModel/Actions/DR/ShutdownAndDestroyVMsAction.cs @@ -84,7 +84,6 @@ namespace XenAdmin.Actions.DR internal static void DestroyVM(Session session, VM vm) { - Exception caught = null; log.DebugFormat("Destroying VM '{0}'", vm.Name()); if (vm.snapshots.Count > 0) @@ -143,9 +142,6 @@ namespace XenAdmin.Actions.DR } log.DebugFormat("VM '{0}' destroyed", vm.Name()); - - if (caught != null) - throw caught; } } } diff --git a/XenModel/XenSearch/QueryTypes.cs b/XenModel/XenSearch/QueryTypes.cs index 7ae873d7b..612ed13a3 100644 --- a/XenModel/XenSearch/QueryTypes.cs +++ b/XenModel/XenSearch/QueryTypes.cs @@ -481,27 +481,31 @@ namespace XenAdmin.XenSearch // item doesn't use a Server). public override bool? MatchProperty(List list) { - bool seenFalse = false; - bool seenNull = false; - foreach (T o in list) + var seenFalse = false; + var seenNull = false; + foreach (var o in list) { if (o != null) { - bool? b = subQuery.Match(o); - if (b == true) - return true; - else if (b == false) - seenFalse = true; - else - seenNull = true; + var b = subQuery.Match(o); + switch (b) + { + case true: + return true; + case false: + seenFalse = true; + break; + default: + seenNull = true; + break; + } } } if (seenFalse) return false; - else if (seenNull) + if (seenNull) return null; - else - return false; + return false; } }