Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssignLicenseDialog"/> class.
        /// </summary>
        public AssignLicenseDialog(IEnumerable <IXenObject> xos, String firstHost, String firstPort, Host.Edition firstEdition)
        {
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "XenObjects");
            this.xos            = new List <IXenObject>(xos);
            this.currentEdition = firstEdition;
            InitializeComponent();
            licenseServerNameTextBox.TextChanged += licenseServerPortTextBox_TextChanged;
            licenseServerPortTextBox.TextChanged += licenseServerNameTextBox_TextChanged;
            LoadLicenseOptions();
            UpdateButtonEnablement();

            // if all the hosts have the same license server details then populate the textboxes.
            List <Host> hosts = CreateHostsList();

            if (hosts[0].license_server.ContainsKey("address") && hosts[0].license_server.ContainsKey("port") &&
                hosts[0].license_server["address"] != "localhost")
            {
                if (hosts.TrueForAll(delegate(Host h)
                {
                    return(h.license_server.ContainsKey("address") &&
                           h.license_server.ContainsKey("port") &&
                           h.license_server["address"] == hosts[0].license_server["address"] &&
                           h.license_server["port"] == hosts[0].license_server["port"]);
                }))
                {
                    licenseServerPortTextBox.Text = hosts[0].license_server["port"];
                    licenseServerNameTextBox.Text = hosts[0].license_server["address"];
                }
            }
            else if ((!String.IsNullOrEmpty(firstHost)) && (!String.IsNullOrEmpty(firstPort)))
            {
                licenseServerPortTextBox.Text = firstPort;
                licenseServerNameTextBox.Text = firstHost;
            }
        }
Example #2
0
        private static bool LicenseMismatch(Host slave, Host master)
        {
            Host.Edition slaveEdition  = Host.GetEdition(slave.edition);
            Host.Edition masterEdition = Host.GetEdition(master.edition);

            return(slaveEdition != Host.Edition.Free && masterEdition != Host.Edition.Free && slaveEdition != masterEdition);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplyLicenseEditionAction"/> class.
        /// </summary>
        /// <param name="xos">The hosts for which the license should be set.</param>
        /// <param name="edition">The edition the hosts should be set to.</param>
        /// <param name="licenseServerAddress">The license server address.</param>
        /// <param name="licenseServerPort">The license server port.</param>
        /// <param name="DoOnLicensingFailure">The method to call when the licensing fails. This method will show failure details in a dialog</param>
        public ApplyLicenseEditionAction(IEnumerable <IXenObject> xos, Host.Edition edition, string licenseServerAddress, string licenseServerPort,
                                         Action <List <LicenseFailure>, string> DoOnLicensingFailure)
            : base(null, Messages.LICENSE_UPDATING_LICENSES)
        {
            LicenseFailures = new List <LicenseFailure>();
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "xenobjects");

            _edition = edition;
            this.xos = xos;
            _licenseServerAddress = licenseServerAddress;
            _licenseServerPort    = licenseServerPort;

            this.DoOnLicensingFailure = DoOnLicensingFailure;

            if (xos != null && Host == null && Pool == null && xos.Count() == 1)
            {
                var xo = xos.FirstOrDefault();
                if (xo is Host)
                {
                    Host = xo as Host;
                }
                else if (xo is Pool)
                {
                    Pool = xo as Pool;
                }
            }
        }
        private void CheckCurrentEdition(Host.Edition currentEdition)
        {
            switch (currentEdition)
            {
            case Host.Edition.XenDesktop:
                CheckRadioButtonIfVisible(xenDesktopEnterpriseRadioButton);
                break;

            case Host.Edition.PerSocket:
                CheckRadioButtonIfVisible(perSocketRadioButton);
                break;

            case Host.Edition.EnterprisePerSocket:
                CheckRadioButtonIfVisible(enterprisePerSocketRadioButton);
                break;

            case Host.Edition.EnterprisePerUser:
                CheckRadioButtonIfVisible(enterprisePerUserRadioButton);
                break;

            case Host.Edition.StandardPerSocket:
                CheckRadioButtonIfVisible(standardPerSocketRadioButton);
                break;

            case Host.Edition.Desktop:
                CheckRadioButtonIfVisible(desktopRadioButton);
                break;

            case Host.Edition.DesktopPlus:
                CheckRadioButtonIfVisible(desktopPlusRadioButton);
                break;
            }
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssignLicenseDialog"/> class.
        /// </summary>
        /// <param name="hosts">The hosts for which the licensing is to be applied.</param>
        public AssignLicenseDialog(IEnumerable<IXenObject> xos, String firstHost, String firstPort, Host.Edition firstEdition)
        {
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "XenObjects");
            this.xos = new List<IXenObject>(xos);
            this.currentEdition = firstEdition;
            InitializeComponent();
            licenseServerNameTextBox.TextChanged += licenseServerPortTextBox_TextChanged;
            licenseServerPortTextBox.TextChanged += licenseServerNameTextBox_TextChanged;
            SetOptionsForClearwaterAndNewer();
            UpdateButtonEnablement();

            // if all the hosts have the same license server details then populate the textboxes.
            List<Host> hosts = CreateHostsList();

            if (hosts[0].license_server.ContainsKey("address") && hosts[0].license_server.ContainsKey("port") &&
                hosts[0].license_server["address"] != "localhost")
            {
                if (hosts.TrueForAll(delegate(Host h)
                {
                    return h.license_server.ContainsKey("address") &&
                        h.license_server.ContainsKey("port") &&
                        h.license_server["address"] == hosts[0].license_server["address"] &&
                        h.license_server["port"] == hosts[0].license_server["port"];
                }))
                {
                    licenseServerPortTextBox.Text = hosts[0].license_server["port"];
                    licenseServerNameTextBox.Text = hosts[0].license_server["address"];
                }
            }
            else if ((!String.IsNullOrEmpty(firstHost)) && (!String.IsNullOrEmpty(firstPort)))
            {
                licenseServerPortTextBox.Text = firstPort;
                licenseServerNameTextBox.Text = firstHost;
            }
        }
Example #6
0
 public ApplyLicenseEditionCommand(IMainWindow mainWindow, IEnumerable <IXenObject> xos,
                                   Host.Edition edition, string licenseServerAddress, string licenseServerPort,
                                   Control parent)
     : base(mainWindow)
 {
     _edition = edition;
     this.xos = xos;
     _licenseServerAddress = licenseServerAddress;
     _licenseServerPort    = licenseServerPort;
     SetParent(parent);
 }
Example #7
0
        private static bool LicenseMismatch(Host slave, Host master)
        {
            if (Helpers.MidnightRideOrGreater(slave) && Helpers.MidnightRideOrGreater(master))
            {
                Host.Edition slaveEdition  = Host.GetEdition(slave.edition);
                Host.Edition masterEdition = Host.GetEdition(master.edition);

                return(slaveEdition != Host.Edition.Free && masterEdition != Host.Edition.Free && slaveEdition != masterEdition);
            }
            return(false);
        }
 public ApplyLicenseEditionCommand(IMainWindow mainWindow, IEnumerable<IXenObject> xos,
     Host.Edition edition, string licenseServerAddress, string licenseServerPort,
     Control parent)
     : base(mainWindow)
 {
     _edition = edition;
     this.xos = xos;
     _licenseServerAddress = licenseServerAddress;
     _licenseServerPort = licenseServerPort;
     SetParent(parent);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplyLicenseEditionAction"/> class. 
        /// </summary>
        /// <param name="xos">The hosts for which the license should be set.</param>
        /// <param name="edition">The edition the hosts should be set to.</param>
        /// <param name="licenseServerAddress">The license server address.</param>
        /// <param name="licenseServerPort">The license server port.</param>
        /// <param name="DoOnLicensingFailure">The method to call when the licensing fails. This method will show failure details in a dialog</param>
        public ApplyLicenseEditionAction(IEnumerable<IXenObject> xos, Host.Edition edition, string licenseServerAddress, string licenseServerPort,
            Action<List<LicenseFailure>, string> DoOnLicensingFailure)
            : base(null, Messages.LICENSE_UPDATING_LICENSES)
        {
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "xenobjects");

            _edition = edition;
            this.xos = xos;
            _licenseServerAddress = licenseServerAddress;
            _licenseServerPort = licenseServerPort;

            this.DoOnLicensingFailure = DoOnLicensingFailure;
        }
Example #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplyLicenseEditionAction"/> class.
        /// </summary>
        /// <param name="xos">The hosts for which the license should be set.</param>
        /// <param name="edition">The edition the hosts should be set to.</param>
        /// <param name="licenseServerAddress">The license server address.</param>
        /// <param name="licenseServerPort">The license server port.</param>
        /// <param name="DoOnLicensingFailure">The method to call when the licensing fails. This method will show failure details in a dialog</param>
        public ApplyLicenseEditionAction(IEnumerable <IXenObject> xos, Host.Edition edition, string licenseServerAddress, string licenseServerPort,
                                         Action <List <LicenseFailure>, string> DoOnLicensingFailure)
            : base(null, Messages.LICENSE_UPDATING_LICENSES)
        {
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "xenobjects");

            _edition = edition;
            this.xos = xos;
            _licenseServerAddress = licenseServerAddress;
            _licenseServerPort    = licenseServerPort;

            this.DoOnLicensingFailure = DoOnLicensingFailure;
        }
Example #11
0
        public string LicenseString()
        {
            var hosts = new List <Host>(Connection.Cache.Hosts);

            foreach (Host.Edition edition in Enum.GetValues(typeof(Host.Edition)))
            {
                Host.Edition edition1 = edition;
                Host         host     = hosts.Find(h => Host.GetEdition(h.edition) == edition1);

                if (host != null)
                {
                    return(Helpers.GetFriendlyLicenseName(host));
                }
            }
            return(PropertyManager.GetFriendlyName("Label-host.edition-free"));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplyLicenseEditionAction"/> class. 
        /// </summary>
        /// <param name="xos">The hosts for which the license should be set.</param>
        /// <param name="edition">The edition the hosts should be set to.</param>
        /// <param name="licenseServerAddress">The license server address.</param>
        /// <param name="licenseServerPort">The license server port.</param>
        /// <param name="DoOnLicensingFailure">The method to call when the licensing fails. This method will show failure details in a dialog</param>
        public ApplyLicenseEditionAction(IEnumerable<IXenObject> xos, Host.Edition edition, string licenseServerAddress, string licenseServerPort,
            Action<List<LicenseFailure>, string> DoOnLicensingFailure)
            : base(null, Messages.LICENSE_UPDATING_LICENSES)
        {
            LicenseFailures = new List<LicenseFailure>();
            Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "xenobjects");

            _edition = edition;
            this.xos = xos;
            _licenseServerAddress = licenseServerAddress;
            _licenseServerPort = licenseServerPort;

            this.DoOnLicensingFailure = DoOnLicensingFailure;

            if (xos != null &&  Host == null && Pool == null && xos.Count() == 1)
            {
                var xo = xos.FirstOrDefault();
                if (xo is Host)
                    Host = xo as Host;
                else if (xo is Pool)
                    Pool = xo as Pool;
            }
        }