示例#1
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con,
                                                               new CrossPoolMigrateWizard(con, selection, preSelectedHost, WizardMode.Copy));
        }
示例#2
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var connection = selection.GetConnectionOfFirstItem();

            if (connection != null && !connection.Session.IsLocalSuperuser && !Registry.DontSudo &&
                connection.Session.Roles.All(r => r.name_label != Role.MR_ROLE_POOL_ADMIN))
            {
                var currentRoles = connection.Session.Roles;
                currentRoles.Sort();

                var msg = string.Format(Messages.ROTATE_POOL_SECRET_RBAC_RESTRICTION, currentRoles[0].FriendlyName(),
                                        Role.FriendlyName(Role.MR_ROLE_POOL_ADMIN));

                using (var dlg = new ErrorDialog(msg))
                    dlg.ShowDialog(Parent);

                return;
            }

            if (Properties.Settings.Default.RemindChangePassword)
            {
                using (var dlg = new InformationDialog(Messages.ROTATE_POOL_SECRET_REMIND_CHANGE_PASSWORD)
                {
                    ShowCheckbox = true, CheckboxCaption = Messages.DO_NOT_SHOW_THIS_MESSAGE
                })
                {
                    dlg.ShowDialog(Parent);
                    Properties.Settings.Default.RemindChangePassword = !dlg.IsCheckBoxChecked;
                }
            }

            new DelegatedAsyncAction(connection, Messages.ROTATE_POOL_SECRET_TITLE,
                                     Messages.ROTATE_POOL_SECRET_TITLE, Messages.COMPLETED,
                                     Pool.rotate_secret, "pool.rotate_secret").RunAsync();
        }
            protected override bool CanExecuteCore(SelectedItemCollection selection)
            {
                IXenConnection connection = selection.GetConnectionOfFirstItem();

                bool atLeastOneCanExecute = false;

                foreach (SelectedItem item in selection)
                {
                    //all items should be VMs
                    VM vm = item.XenObject as VM;
                    if (vm == null)
                    {
                        return(false);
                    }

                    // all VMs must be on the same connection
                    if (connection != null && vm.Connection != connection)
                    {
                        return(false);
                    }

                    //at least one VM should be able to execute
                    if (CanExecute(vm))
                    {
                        atLeastOneCanExecute = true;
                    }
                }
                return(atLeastOneCanExecute);
            }
示例#4
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            if (Helpers.FeatureForbidden(con, Host.RestrictConversion))
            {
                var msg = HiddenFeatures.LinkLabelHidden
                    ? Messages.UPSELL_BLURB_CONVERSION
                    : Messages.UPSELL_BLURB_CONVERSION + Messages.UPSELL_BLURB_TRIAL;

                using (var dlg = new UpsellDialog(msg, InvisibleMessages.UPSELL_LEARNMOREURL_TRIAL))
                    dlg.ShowDialog(Parent);
            }
            else if (!con.Session.IsLocalSuperuser && !Registry.DontSudo && con.Session.Roles.All(r => r.name_label != Role.MR_ROLE_POOL_ADMIN))
            {
                var currentRoles = con.Session.Roles;
                currentRoles.Sort();

                var msg = string.Format(Messages.CONVERSION_RBAC_RESTRICTION, currentRoles[0].FriendlyName(),
                                        Role.FriendlyName(Role.MR_ROLE_POOL_ADMIN));

                using (var dlg = new ErrorDialog(msg))
                    dlg.ShowDialog(Parent);
            }
            else if (selection.First is VM vm && vm.IsConversionVM())
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(con, new ConversionDialog(con, vm));
            }
示例#5
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            if (Helpers.FeatureForbidden(con, Host.RestrictCrossPoolMigrate))
            {
                ShowUpsellDialog(Parent);
            }
            else
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(con, new CrossPoolMigrateWizard(con, selection, preSelectedHost));
            }
        }
示例#6
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var cmd = new CrossPoolMoveVMCommand(MainWindowCommandInterface, selection);
            var con = selection.GetConnectionOfFirstItem();

            if (cmd.CanExecute() && !Helpers.FeatureForbidden(con, Host.RestrictCrossPoolMigrate))
            {
                cmd.Execute();
            }
            else
            {
                VM vm = (VM)selection[0].XenObject;
                MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new MoveVMDialog(vm));
            }
        }
示例#7
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con, new ExportApplianceWizard(con, selection));
        }
示例#8
0
        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            return(con != null && con.Cache.VMs.Any(v => v.IsConversionVM()));
        }
示例#9
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var vdis = selection.AsXenObjects <VDI>();

            new MoveVirtualDiskDialog(selection.GetConnectionOfFirstItem(), vdis, null).Show(Program.MainWindow);
        }
示例#10
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con, new ImportWizard(con, selection.FirstAsXenObject, null, false));
        }