Beispiel #1
0
 private void ShowUpsell()
 {
     using (var 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);
 }
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            Dictionary <SelectedItem, string> reasons = new Dictionary <SelectedItem, string>();

            foreach (Host host in _hosts)
            {
                PoolJoinRules.Reason reason = PoolJoinRules.CanJoinPool(host.Connection, _pool.Connection, true, true, true);
                if (reason != PoolJoinRules.Reason.Allowed)
                {
                    reasons[new SelectedItem(host)] = PoolJoinRules.ReasonMessage(reason);
                }
            }

            if (reasons.Count > 0)
            {
                string title = Messages.ERROR_DIALOG_ADD_TO_POOL_TITLE;
                string text  = string.Format(Messages.ERROR_DIALOG_ADD_TO_POOL_TEXT, Helpers.GetName(_pool).Ellipsise(500));

                new CommandErrorDialog(title, text, reasons).ShowDialog(Parent);
                return;
            }

            if (_confirm && !ShowConfirmationDialog())
            {
                // Bail out if the user doesn't want to continue.
                return;
            }

            if (!Helpers.IsConnected(_pool))
            {
                string message = _hosts.Count == 1
                                     ? string.Format(Messages.ADD_HOST_TO_POOL_DISCONNECTED_POOL,
                                                     Helpers.GetName(_hosts[0]).Ellipsise(500), Helpers.GetName(_pool).Ellipsise(500))
                                     : string.Format(Messages.ADD_HOST_TO_POOL_DISCONNECTED_POOL_MULTIPLE,
                                                     Helpers.GetName(_pool).Ellipsise(500));

                using (var dlg = new ThreeButtonDialog(
                           new ThreeButtonDialog.Details(SystemIcons.Error, message, Messages.XENCENTER)))
                {
                    dlg.ShowDialog(Parent);
                }
                return;
            }

            // Check supp packs and warn
            List <string> badSuppPacks = PoolJoinRules.HomogeneousSuppPacksDiffering(_hosts, _pool);

            if (!HelpersGUI.GetPermissionFor(badSuppPacks, sp => true,
                                             Messages.ADD_HOST_TO_POOL_SUPP_PACK, Messages.ADD_HOST_TO_POOL_SUPP_PACKS, false, "PoolJoinSuppPacks"))
            {
                return;
            }

            // Are there any hosts which are forbidden from masking their CPUs for licensing reasons?
            // If so, we need to show upsell.
            Host master = Helpers.GetMaster(_pool);

            if (null != _hosts.Find(host =>
                                    !PoolJoinRules.CompatibleCPUs(host, master, false) &&
                                    Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
                                    !PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
            {
                using (var 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;
            }

            // Get permission for any fix-ups: 1) Licensing free hosts; 2) CPU masking 3) Ad configuration 4) CPU feature levelling (Dundee or higher only)
            // (We already know that these things are fixable because we have been through CanJoinPool() above).
            if (!HelpersGUI.GetPermissionFor(_hosts, host => PoolJoinRules.FreeHostPaidMaster(host, master, false),
                                             Messages.ADD_HOST_TO_POOL_LICENSE_MESSAGE, Messages.ADD_HOST_TO_POOL_LICENSE_MESSAGE_MULTIPLE, true, "PoolJoinRelicensing")
                ||
                !HelpersGUI.GetPermissionFor(_hosts, host => !PoolJoinRules.CompatibleCPUs(host, master, false),
                                             Messages.ADD_HOST_TO_POOL_CPU_MASKING_MESSAGE, Messages.ADD_HOST_TO_POOL_CPU_MASKING_MESSAGE_MULTIPLE, true, "PoolJoinCpuMasking")
                ||
                !HelpersGUI.GetPermissionFor(_hosts, host => !PoolJoinRules.CompatibleAdConfig(host, master, false),
                                             Messages.ADD_HOST_TO_POOL_AD_MESSAGE, Messages.ADD_HOST_TO_POOL_AD_MESSAGE_MULTIPLE, true, "PoolJoinAdConfiguring")
                ||
                !HelpersGUI.GetPermissionForCpuFeatureLevelling(_hosts, _pool))
            {
                return;
            }

            MainWindowCommandInterface.SelectObjectInTree(_pool);

            List <AsyncAction> actions = new List <AsyncAction>();

            foreach (Host host in _hosts)
            {
                string opaque_ref          = host.opaque_ref;
                AddHostToPoolAction action = new AddHostToPoolAction(_pool, host, GetAdPrompt, NtolDialog, ApplyLicenseEditionCommand.ShowLicensingFailureDialog);
                action.Completed += s => Program.ShowObject(opaque_ref);
                actions.Add(action);

                // hide connection. If the action fails, re-show it.
                Program.HideObject(opaque_ref);
            }

            RunMultipleActions(actions, string.Format(Messages.ADDING_SERVERS_TO_POOL, _pool.Name), Messages.POOLCREATE_ADDING, Messages.POOLCREATE_ADDED, true);
        }
 public static void ShowUpsellDialog(IWin32Window parent)
 {
     using (var 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);
 }
        public static void ShowUpsellDialog(IWin32Window parent)
        {
            UpsellDialog dlg = new UpsellDialog(Messages.MIGRATE_VDI_UPSELL_BLURB, InvisibleMessages.UPSELL_LEARNMOREURL_CPM);

            dlg.ShowDialog(parent);
        }
Beispiel #5
0
        public static void ShowUpsellDialog(IWin32Window parent)
        {
            UpsellDialog dlg = new UpsellDialog(VMGroup <T> .UpsellBlurb, VMGroup <T> .UpsellLearnMoreUrl);

            dlg.ShowDialog(parent);
        }
Beispiel #6
0
        private void ShowUpsell()
        {
            UpsellDialog upsellDialog = new UpsellDialog(Messages.UPSELL_BLURB_PERFORMANCE, InvisibleMessages.UPSELL_LEARNMOREURL_PERFORMANCE);

            upsellDialog.ShowDialog(this);
        }