Merge pull request #796 from MihaelaStoica/CA-196887

CA-196887: New function for reading registry key written by the installer
This commit is contained in:
Mihaela Stoica 2016-01-29 09:20:11 +00:00
commit f6a6451e56
43 changed files with 216 additions and 161 deletions

View File

@ -348,7 +348,7 @@ namespace XenAdmin.Alerts
case XenAPI.Message.MessageType.LICENSE_EXPIRES_SOON:
case XenAPI.Message.MessageType.LICENSE_DOES_NOT_SUPPORT_POOLING:
return () => Program.OpenURL(XenAdmin.Core.Registry.LinkLabelHidden ? null : InvisibleMessages.LICENSE_EXPIRY_WEBPAGE);
return () => Program.OpenURL(HiddenFeatures.LinkLabelHidden ? null : InvisibleMessages.LICENSE_EXPIRY_WEBPAGE);
case XenAPI.Message.MessageType.VBD_QOS_FAILED:
case XenAPI.Message.MessageType.VCPU_QOS_FAILED:
case XenAPI.Message.MessageType.VIF_QOS_FAILED:

View File

@ -121,7 +121,7 @@ namespace XenAdmin.Commands
Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
!PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
{
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING);
dlg.ShowDialog(Parent);
return;

View File

@ -1,34 +1,34 @@
using System.Linq;
using XenAdmin.Core;
using XenAPI;
namespace XenAdmin.Commands
{
internal class HealthCheckCommand : Command
{
/// <summary>
/// Initializes a new instance of this Command. The parameter-less constructor is required if
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
/// </summary>
public HealthCheckCommand()
{
}
public HealthCheckCommand(IMainWindow mainWindow)
: base(mainWindow)
{
}
protected override void ExecuteCore(SelectedItemCollection selection)
using System.Linq;
using XenAdmin.Core;
using XenAPI;
namespace XenAdmin.Commands
{
internal class HealthCheckCommand : Command
{
/// <summary>
/// Initializes a new instance of this Command. The parameter-less constructor is required if
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
/// </summary>
public HealthCheckCommand()
{
if (Program.MainWindow.HealthCheckOverviewLauncher != null && !XenAdmin.Core.Registry.HealthCheckHidden)
Program.MainWindow.HealthCheckOverviewLauncher.LaunchIfRequired(false, selection);
}
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return ConnectionsManager.XenConnectionsCopy.Any(xenConnection => xenConnection.IsConnected
&& !Helpers.FeatureForbidden(xenConnection, Host.RestrictHealthCheck));
}
}
}
}
public HealthCheckCommand(IMainWindow mainWindow)
: base(mainWindow)
{
}
protected override void ExecuteCore(SelectedItemCollection selection)
{
if (Program.MainWindow.HealthCheckOverviewLauncher != null && !HiddenFeatures.HealthCheckHidden)
Program.MainWindow.HealthCheckOverviewLauncher.LaunchIfRequired(false, selection);
}
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return ConnectionsManager.XenConnectionsCopy.Any(xenConnection => xenConnection.IsConnected
&& !Helpers.FeatureForbidden(xenConnection, Host.RestrictHealthCheck));
}
}
}

View File

@ -93,7 +93,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_CPM: Messages.UPSELL_BLURB_CPM + Messages.UPSELL_BLURB_CPM_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPM : Messages.UPSELL_BLURB_CPM + Messages.UPSELL_BLURB_CPM_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM);
dlg.ShowDialog(parent);
}

View File

@ -118,7 +118,7 @@ namespace XenAdmin.Commands
private static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
dlg.ShowDialog(parent);
}

View File

@ -94,7 +94,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
dlg.ShowDialog(parent);
}

View File

@ -97,7 +97,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
dlg.ShowDialog(parent);
}

View File

@ -94,7 +94,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
dlg.ShowDialog(parent);
}

View File

@ -91,7 +91,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
dlg.ShowDialog(parent);
}

View File

@ -63,7 +63,7 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(selection[0].XenObject, Host.RestrictWLB))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB);
dlg.ShowDialog(Parent);
return;

View File

@ -82,7 +82,7 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_HA);
dlg.ShowDialog(Parent);
}

View File

@ -85,7 +85,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.MIGRATE_VDI_UPSELL_BLURB : Messages.MIGRATE_VDI_UPSELL_BLURB + Messages.MIGRATE_VDI_UPSELL_BLURB_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.MIGRATE_VDI_UPSELL_BLURB : Messages.MIGRATE_VDI_UPSELL_BLURB + Messages.MIGRATE_VDI_UPSELL_BLURB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM);
dlg.ShowDialog(parent);
}

View File

@ -84,7 +84,7 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(selection[0].XenObject, Host.RestrictWLB))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB);
dlg.ShowDialog(Parent);
return;

View File

@ -57,7 +57,7 @@ namespace XenAdmin.Controls
public DeprecationBanner()
{
InitializeComponent();
HelperLinkVisible = !XenAdmin.Core.Registry.LinkLabelHidden;
HelperLinkVisible = !XenAdmin.Core.HiddenFeatures.LinkLabelHidden;
Visible = false;
helperLink.Click += helperLink_Click;
BackgroundColour = defaultBackgroundColour;

View File

@ -51,7 +51,7 @@ namespace XenAdmin.Controls
public UpsellPage()
{
InitializeComponent();
this.LearnMoreButton.Visible = !XenAdmin.Core.Registry.LearnMoreButtonHidden;
this.LearnMoreButton.Visible = !HiddenFeatures.LearnMoreButtonHidden;
}
public void enableOkButton()

View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XenAdmin.Core
{
public class HiddenFeatures
{
internal static bool CPSOptimizationHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(CPS_OPTIMIZATION_HIDDEN); }
}
internal static bool RDPPollingHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(RDP_POLLING_HIDDEN); }
}
internal static bool LearnMoreButtonHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(LEARN_MORE_HIDDEN); }
}
internal static bool LinkLabelHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(LINK_LABEL_HIDDEN); }
}
internal static bool ToolStripMenuItemHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(TOOL_STRIP_MENU_ITEM_HIDDEN); }
}
internal static bool CrossServerPrivateNetworkHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(CROSS_SERVER_PRIVATE_NETWORK_HIDDEN); }
}
internal static bool CopyrightHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(COPYRIGHT_HIDDEN); }
}
internal static bool HealthCheckHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(HEALTH_CHECK_HIDDEN); }
}
internal static bool UploadOptionHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(UPLOAD_OPTION_HIDDEN); }
}
internal static bool LicenseNagHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(LICENSE_NAG_HIDDEN); }
}
internal static bool LicenseOperationsHidden
{
get
{ return Registry.HiddenFeatures != null && Registry.HiddenFeatures.Contains(LICENSE_OPERATIONS_HIDDEN); }
}
private const string CPS_OPTIMIZATION_HIDDEN = "cps_optimization";
private const string RDP_POLLING_HIDDEN = "rdp_polling";
private const string LEARN_MORE_HIDDEN = "learn_more";
private const string LINK_LABEL_HIDDEN = "link_label";
private const string TOOL_STRIP_MENU_ITEM_HIDDEN = "tool_strip_menu_item";
private const string CROSS_SERVER_PRIVATE_NETWORK_HIDDEN = "cross_server_private_network";
private const string COPYRIGHT_HIDDEN = "copyright";
private const string HEALTH_CHECK_HIDDEN = "health_check";
private const string UPLOAD_OPTION_HIDDEN = "upload_option";
private const string LICENSE_NAG_HIDDEN = "license_nag";
private const string LICENSE_OPERATIONS_HIDDEN = "license_operations";
}
}

View File

@ -271,7 +271,7 @@ namespace XenAdmin.Core
}
/// <summary>
/// Reads a key from XENCENTER_LOCAL_KEYS\k.
/// Reads a key from HKEY_LOCAL_MACHINE\XENCENTER_LOCAL_KEYS\k.
/// </summary>
private static string ReadKey(string k)
{
@ -299,6 +299,46 @@ namespace XenAdmin.Core
}
}
/// <summary>
/// Reads a key from hKey\XENCENTER_LOCAL_KEYS\k, targeting the 32-bit registry view
/// </summary>
private static string ReadKey(string k, RegistryHive hKey)
{
try
{
RegistryKey masterKey = RegistryKey.OpenBaseKey(hKey, RegistryView.Registry32);
masterKey = masterKey.OpenSubKey(XENCENTER_LOCAL_KEYS) ?? null;
if (masterKey == null)
return null;
try
{
var v = masterKey.GetValue(k);
return (v != null) ? v.ToString() : null;
}
finally
{
masterKey.Close();
}
}
catch (Exception e)
{
log.DebugFormat(@"Failed to read {0}\{1} from registry; assuming NULL.", XENCENTER_LOCAL_KEYS, k);
log.Debug(e, e);
return null;
}
}
/// <summary>
/// Reads a key from XENCENTER_LOCAL_KEYS\k, trying CurrentUser first and then LocalMachine
/// </summary>
private static string ReadInstalledKey(string k)
{
var v = ReadKey(k, RegistryHive.CurrentUser);
return (v != null) ? v : ReadKey(k, RegistryHive.LocalMachine);
}
public static string HealthCheckIdentityTokenDomainName
{
get { return ReadKey(HEALTH_CHECK_IDENTITY_TOKEN_DOMAIN_NAME); }
@ -331,73 +371,7 @@ namespace XenAdmin.Core
public static string HiddenFeatures
{
get { return ReadKey(HIDDEN_FEATURES); }
}
internal static bool CPSOptimizationHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(CPS_OPTIMIZATION_HIDDEN); }
}
internal static bool RDPPollingHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(RDP_POLLING_HIDDEN); }
}
internal static bool LearnMoreButtonHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(LEARN_MORE_HIDDEN); }
}
internal static bool LinkLabelHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(LINK_LABEL_HIDDEN); }
}
internal static bool ToolStripMenuItemHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(TOOL_STRIP_MENU_ITEM_HIDDEN); }
}
internal static bool CrossServerPrivateNetworkHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(CROSS_SERVER_PRIVATE_NETWORK_HIDDEN); }
}
internal static bool CopyrightHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(COPYRIGHT_HIDDEN); }
}
internal static bool HealthCheckHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(HEALTH_CHECK_HIDDEN); }
}
internal static bool UploadOptionHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(UPLOAD_OPTION_HIDDEN); }
}
internal static bool LicenseNagHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(LICENSE_NAG_HIDDEN); }
}
internal static bool LicenseOperationsHidden
{
get
{ return HiddenFeatures != null && HiddenFeatures.Contains(LICENSE_OPERATIONS_HIDDEN); }
get { return ReadInstalledKey(HIDDEN_FEATURES); }
}
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
@ -422,17 +396,6 @@ namespace XenAdmin.Core
private const string HEALTH_CHECK_DIAGNOSTIC_DOMAIN_NAME = "HealthCheckDiagnosticDomainName";
private const string HEALTH_CHECK_PRODUCT_KEY = "HealthCheckProductKey";
private const string HIDDEN_FEATURES = "HiddenFeatures";
private const string CPS_OPTIMIZATION_HIDDEN = "cps_optimization";
private const string RDP_POLLING_HIDDEN = "rdp_polling";
private const string LEARN_MORE_HIDDEN = "learn_more";
private const string LINK_LABEL_HIDDEN = "link_label";
private const string TOOL_STRIP_MENU_ITEM_HIDDEN = "tool_strip_menu_item";
private const string CROSS_SERVER_PRIVATE_NETWORK_HIDDEN = "cross_server_private_network";
private const string COPYRIGHT_HIDDEN = "copyright";
private const string HEALTH_CHECK_HIDDEN = "health_check";
private const string UPLOAD_OPTION_HIDDEN = "upload_option";
private const string LICENSE_NAG_HIDDEN = "license_nag";
private const string LICENSE_OPERATIONS_HIDDEN = "license_operations";
}
public enum SSLCertificateTypes { None, Changed, All }

View File

@ -141,7 +141,7 @@ namespace XenAdmin.Core
{
get
{
if (XenAdmin.Core.Registry.LinkLabelHidden)
if (HiddenFeatures.LinkLabelHidden)
return typeof(T) == typeof(VMPP) ? Messages.UPSELL_BLURB_VM_PROTECTION : Messages.UPSELL_BLURB_VM_APPLIANCES;
else
return typeof(T) == typeof(VMPP) ? Messages.UPSELL_BLURB_VM_PROTECTION + Messages.UPSELL_BLURB_VM_PROTECTION_MORE : Messages.UPSELL_BLURB_VM_APPLIANCES + Messages.UPSELL_BLURB_VM_APPLIANCES_MORE;

View File

@ -56,7 +56,7 @@ namespace XenAdmin.Diagnostics.Problems.ConnectionProblem
public override Uri UriToLaunch
{
get {
return XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.VMPR_DEPRECATION_URL);
return XenAdmin.Core.HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.VMPR_DEPRECATION_URL);
}
}
}

View File

@ -57,7 +57,7 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
public override Uri UriToLaunch
{
get {
return XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.WSS_DEPRECATION_URL);
return XenAdmin.Core.HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.WSS_DEPRECATION_URL);
}
}
}

View File

@ -46,7 +46,7 @@ namespace XenAdmin.Diagnostics.Problems.SRProblem
public override Uri UriToLaunch {
get
{
return XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
return XenAdmin.Core.HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
}
}

View File

@ -54,7 +54,7 @@ namespace XenAdmin.Dialogs
VersionLabel.Text = string.Format(Messages.VERSION_NUMBER, Branding.PRODUCT_VERSION_TEXT,
Branding.XENCENTER_VERSION, buildText, IntPtr.Size * 8);
label2.Text = string.Format(Messages.COPYRIGHT, Branding.COMPANY_NAME_LEGAL);
label2.Visible = !Registry.CopyrightHidden;
label2.Visible = !HiddenFeatures.CopyrightHidden;
}
private void OkButton_Click(object sender, EventArgs e)

View File

@ -40,7 +40,7 @@ namespace XenAdmin.Dialogs
public ConnectionRefusedDialog()
{
InitializeComponent();
this.linkLabel.Visible = !XenAdmin.Core.Registry.LinkLabelHidden;
this.linkLabel.Visible = !XenAdmin.Core.HiddenFeatures.LinkLabelHidden;
}
public string ErrorMessage

View File

@ -46,7 +46,7 @@ namespace XenAdmin.Dialogs
{
InitializeComponent();
label2.Text = string.Format(Messages.COPYRIGHT, Branding.COMPANY_NAME_LEGAL);
this.label1.Visible = this.label2.Visible = !XenAdmin.Core.Registry.CopyrightHidden;
this.label1.Visible = this.label2.Visible = !XenAdmin.Core.HiddenFeatures.CopyrightHidden;
}
private void button1_Click(object sender, EventArgs e)

View File

@ -53,7 +53,7 @@ namespace XenAdmin.Dialogs
{
ActivationRequest = new LicenseActivationRequest();
VerifierFactory = new LicenseSelectionVerifierFactory();
ReadOnlyView = Registry.LicenseOperationsHidden;
ReadOnlyView = HiddenFeatures.LicenseOperationsHidden;
}
public LicenseManagerController(ILicenseManagerView view)

View File

@ -161,7 +161,7 @@ namespace XenAdmin.Dialogs
Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
!PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
{
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING);
dlg.ShowDialog(this);
return;

View File

@ -37,6 +37,7 @@ using System.Data;
using System.Text;
using System.Windows.Forms;
using XenAdmin.Properties;
using XenAdmin.Core;
namespace XenAdmin.Dialogs.OptionsPages
@ -74,7 +75,7 @@ namespace XenAdmin.Dialogs.OptionsPages
// Console scaling
PreserveUndockedScaleCheckBox.Checked = Properties.Settings.Default.PreserveScaleWhenUndocked;
PreserveVNCConsoleScalingCheckBox.Checked = Properties.Settings.Default.PreserveScaleWhenSwitchBackToVNC;
checkBoxDisableRDPPolling.Visible = !XenAdmin.Core.Registry.RDPPollingHidden;
checkBoxDisableRDPPolling.Visible = !HiddenFeatures.RDPPollingHidden;
checkBoxDisableRDPPolling.Checked = Properties.Settings.Default.EnableRDPPolling;
}

View File

@ -68,7 +68,7 @@ namespace XenAdmin.Dialogs.OptionsPages
InitializeComponent();
m_tlpScanning.Visible = false;
labelNoPlugins.Visible = false;
this.linkLabel1.Visible = !XenAdmin.Core.Registry.LinkLabelHidden;
this.linkLabel1.Visible = !XenAdmin.Core.HiddenFeatures.LinkLabelHidden;
}
public static void Log()

View File

@ -156,7 +156,7 @@ namespace XenAdmin.Dialogs
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictAlerts))
{
PerfmonAlertUpsellEditPage = new UpsellPage {Image = Properties.Resources._000_Alert2_h32bit_16, Text = Messages.ALERTS};
PerfmonAlertUpsellEditPage.SetAllTexts(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_ALERTS : Messages.UPSELL_BLURB_ALERTS + Messages.UPSELL_BLURB_ALERTS_MORE,
PerfmonAlertUpsellEditPage.SetAllTexts(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_ALERTS : Messages.UPSELL_BLURB_ALERTS + Messages.UPSELL_BLURB_ALERTS_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_ALERTS);
ShowTab(PerfmonAlertUpsellEditPage);
}
@ -171,7 +171,7 @@ namespace XenAdmin.Dialogs
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictAlerts))
{
PerfmonAlertOptionsUpsellEditPage = new UpsellPage {Image = Properties.Resources._000_Email_h32bit_16, Text = Messages.EMAIL_OPTIONS};
PerfmonAlertOptionsUpsellEditPage.SetAllTexts(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_ALERTS : Messages.UPSELL_BLURB_ALERTS + Messages.UPSELL_BLURB_ALERTS_MORE,
PerfmonAlertOptionsUpsellEditPage.SetAllTexts(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_ALERTS : Messages.UPSELL_BLURB_ALERTS + Messages.UPSELL_BLURB_ALERTS_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_ALERTS);
ShowTab(PerfmonAlertOptionsUpsellEditPage);
}
@ -211,7 +211,7 @@ namespace XenAdmin.Dialogs
if (Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictGpu))
{
GpuUpsellEditPage = new UpsellPage { Image = Properties.Resources._000_GetMemoryInfo_h32bit_16, Text = Messages.GPU };
GpuUpsellEditPage.SetAllTexts(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_GPU : Messages.UPSELL_BLURB_GPU + Messages.UPSELL_BLURB_GPU_MORE,
GpuUpsellEditPage.SetAllTexts(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_GPU : Messages.UPSELL_BLURB_GPU + Messages.UPSELL_BLURB_GPU_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_GPU);
ShowTab(GpuUpsellEditPage);
}

View File

@ -296,7 +296,7 @@ namespace XenAdmin.Dialogs.VMProtection_Recovery
deprecationBanner.AppliesToVersion = Messages.XENSERVER_6_2;
deprecationBanner.BannerType = DeprecationBanner.Type.Removal;
deprecationBanner.FeatureName = Messages.VMPP;
deprecationBanner.LinkUri = XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.VMPR_DEPRECATION_URL);
deprecationBanner.LinkUri = HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.VMPR_DEPRECATION_URL);
deprecationBanner.Visible = true;
}
}

View File

@ -76,7 +76,7 @@ namespace XenAdmin
internal bool CheckActiveServerLicense(IXenConnection connection, bool periodicCheck)
{
// don't popup the license manager dialog if host is ClearwaterOrGreater and the feature is disabled
bool popupLicenseMgr = !(Helpers.ClearwaterOrGreater(connection) && Registry.LicenseNagHidden);
bool popupLicenseMgr = !(Helpers.ClearwaterOrGreater(connection) && HiddenFeatures.LicenseNagHidden);
// If the host is Dundee or greater, then the license alerts are generated by the server, so XenCenter shouldn't create any license alerts
bool createAlert = !Helpers.DundeeOrGreater(connection);

View File

@ -226,8 +226,8 @@ namespace XenAdmin
licenseTimer = new LicenseTimer(licenseManagerLauncher);
GeneralPage.LicenseLauncher = licenseManagerLauncher;
toolStripSeparator7.Visible = xenSourceOnTheWebToolStripMenuItem.Visible = xenCenterPluginsOnlineToolStripMenuItem.Visible = !XenAdmin.Core.Registry.ToolStripMenuItemHidden;
healthCheckToolStripMenuItem1.Visible = !XenAdmin.Core.Registry.HealthCheckHidden;
toolStripSeparator7.Visible = xenSourceOnTheWebToolStripMenuItem.Visible = xenCenterPluginsOnlineToolStripMenuItem.Visible = !HiddenFeatures.ToolStripMenuItemHidden;
healthCheckToolStripMenuItem1.Visible = !HiddenFeatures.HealthCheckHidden;
}
private void Default_SettingChanging(object sender, SettingChangingEventArgs e)
@ -808,7 +808,7 @@ namespace XenAdmin
Program.Invoke(Program.MainWindow, delegate()
{
string msg = string.Format(Messages.GUI_OUT_OF_DATE, Helpers.GetName(master));
if (!XenAdmin.Core.Registry.LinkLabelHidden)
if (!HiddenFeatures.LinkLabelHidden)
msg = msg + Messages.GUI_OUT_OF_DATE_MORE;
string url = "https://" + connection.Hostname;
@ -857,7 +857,7 @@ namespace XenAdmin
private void CheckHealthCheckEnrollment(object connection)
{
if (HealthCheckOverviewLauncher != null && !XenAdmin.Core.Registry.HealthCheckHidden)
if (HealthCheckOverviewLauncher != null && !HiddenFeatures.HealthCheckHidden)
HealthCheckOverviewLauncher.CheckHealthCheckEnrollment((IXenConnection) connection);
}

View File

@ -65,7 +65,7 @@ namespace XenAdmin.SettingsPanels
ToolTipIcon = ToolTipIcon.Warning,
ToolTipTitle = Messages.INVALID_PARAMETER
};
this.CPSOptimizationRadioButton.Visible = !XenAdmin.Core.Registry.CPSOptimizationHidden;
this.CPSOptimizationRadioButton.Visible = !HiddenFeatures.CPSOptimizationHidden;
}
public String SubText

View File

@ -1019,7 +1019,7 @@ namespace XenAdmin.TabPages
if (Helpers.FeatureForbidden(pool.Connection, Host.RestrictRBAC))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_RBAC : Messages.UPSELL_BLURB_RBAC + Messages.UPSELL_BLURB_RBAC_MORE,
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_RBAC : Messages.UPSELL_BLURB_RBAC + Messages.UPSELL_BLURB_RBAC_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_RBAC);
dlg.ShowDialog(this);
return;

View File

@ -89,7 +89,7 @@ namespace XenAdmin.TabPages
private void panelTry_Click(object sender, EventArgs e)
{
if (!XenAdmin.Core.Registry.LinkLabelHidden)
if (!HiddenFeatures.LinkLabelHidden)
Program.OpenURL(InvisibleMessages.XENDESKTOP_URL);
}

View File

@ -303,7 +303,7 @@ namespace XenAdmin.TabPages
private void ShowUpsell()
{
UpsellDialog upsellDialog = new UpsellDialog(XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_PERFORMANCE : Messages.UPSELL_BLURB_PERFORMANCE + Messages.UPSELL_BLURB_PERFORMANCE_MORE,
UpsellDialog upsellDialog = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_PERFORMANCE : Messages.UPSELL_BLURB_PERFORMANCE + Messages.UPSELL_BLURB_PERFORMANCE_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_PERFORMANCE);
upsellDialog.ShowDialog(this);
}

View File

@ -116,8 +116,8 @@ namespace XenAdmin.TabPages
Banner.AppliesToVersion = Messages.XENSERVER_6_5;
Banner.BannerType = DeprecationBanner.Type.Removal;
Banner.FeatureName = Messages.ISL_SR;
Banner.LinkUri = XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
Banner.Visible = !XenAdmin.Core.Registry.LinkLabelHidden;
Banner.LinkUri = HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
Banner.Visible = !HiddenFeatures.LinkLabelHidden;
}
else
Banner.Visible = false;

View File

@ -36,6 +36,7 @@ using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using XenAdmin.Core;
namespace XenAdmin.TabPages
@ -54,14 +55,14 @@ namespace XenAdmin.TabPages
public class BallooningUpsellPage : UpsellTabPage
{
public BallooningUpsellPage()
: base(Messages.DYNAMIC_MEMORY_CONTROL, XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_DMC : Messages.UPSELL_BLURB_DMC + Messages.UPSELL_BLURB_DMC_MORE, InvisibleMessages.UPSELL_LEARNMOREURL_DMC)
: base(Messages.DYNAMIC_MEMORY_CONTROL, HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DMC : Messages.UPSELL_BLURB_DMC + Messages.UPSELL_BLURB_DMC_MORE, InvisibleMessages.UPSELL_LEARNMOREURL_DMC)
{ }
}
public class HAUpsellPage : UpsellTabPage
{
public HAUpsellPage()
: base(Messages.HIGH_AVAILABILITY, XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE, InvisibleMessages.UPSELL_LEARNMOREURL_HA)
: base(Messages.HIGH_AVAILABILITY, HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE, InvisibleMessages.UPSELL_LEARNMOREURL_HA)
{ }
}
@ -69,7 +70,7 @@ namespace XenAdmin.TabPages
{
public WLBUpsellPage()
: base(Messages.WORKLOAD_BALANCING,
XenAdmin.Core.Registry.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB)
{ }
}

View File

@ -73,7 +73,7 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
}
usernameTextBox.Visible = usernameLabel.Visible = passwordLabel.Visible = passwordTextBox.Visible =
caseNumberLabel.Visible = caseNumberTextBox.Visible = optionalLabel.Visible =
richTextBox1.Visible = uploadCheckBox.Visible = !XenAdmin.Core.Registry.UploadOptionHidden;
richTextBox1.Visible = uploadCheckBox.Visible = !HiddenFeatures.UploadOptionHidden;
}
public override string Text { get { return Messages.BUGTOOL_PAGE_DESTINATION_TEXT; } }

View File

@ -66,7 +66,7 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
//set this here due to a framework bug
splitContainer1.Panel1MinSize = 250;
splitContainer1.Panel2MinSize = 200;
this.linkLabel1.Visible = !XenAdmin.Core.Registry.LinkLabelHidden;
this.linkLabel1.Visible = !XenAdmin.Core.HiddenFeatures.LinkLabelHidden;
}
public override string Text{get { return Messages.BUGTOOL_PAGE_CAPABILITIES_TEXT; }}

View File

@ -82,7 +82,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
return;
Pool pool = Helpers.GetPoolOfOne(connection);
labelCHIN.Visible = rbtnCHIN.Visible = !XenAdmin.Core.Registry.CrossServerPrivateNetworkHidden;
labelCHIN.Visible = rbtnCHIN.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden;
if (!pool.vSwitchController)
{
rbtnCHIN.Checked = false;
@ -93,7 +93,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
Messages.FIELD_DISABLED :
Messages.CHINS_NEED_VSWITCHCONTROLLER;
iconWarningChinOption.Visible = labelWarningChinOption.Visible = !XenAdmin.Core.Registry.CrossServerPrivateNetworkHidden;
iconWarningChinOption.Visible = labelWarningChinOption.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden;
rbtnExternalNetwork.Checked = true;
}

View File

@ -72,8 +72,8 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
deprecationBanner.AppliesToVersion = Messages.XENSERVER_6_5;
deprecationBanner.BannerType = DeprecationBanner.Type.Removal;
deprecationBanner.FeatureName = Messages.ISL_SR;
deprecationBanner.LinkUri = XenAdmin.Core.Registry.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
deprecationBanner.Visible = !XenAdmin.Core.Registry.LinkLabelHidden;
deprecationBanner.LinkUri = HiddenFeatures.LinkLabelHidden ? null : new Uri(InvisibleMessages.ISL_DEPRECATION_URL);
deprecationBanner.Visible = !HiddenFeatures.LinkLabelHidden;
}
else
deprecationBanner.Visible = false;

View File

@ -205,6 +205,7 @@
<DependentUpon>UpsellPage.cs</DependentUpon>
</Compile>
<Compile Include="Core\HealthCheck.cs" />
<Compile Include="Core\HiddenFeatures.cs" />
<Compile Include="Diagnostics\Checks\AssertCanEvacuateCheck.cs" />
<Compile Include="Diagnostics\Checks\AssertCanEvacuateUpgradeCheck.cs" />
<Compile Include="Diagnostics\Checks\SafeToUpgradeCheck.cs" />