Ejemplo n.º 1
0
            protected override void ExecuteCore(SelectedItemCollection selection)
            {
                // remove single VM from group
                if (selection.Count == 1)
                {
                    XenRef <VM> vmRefInGroup = VMGroup <T> .GroupToVMs(_group).FirstOrDefault(vmRef => vmRef.opaque_ref == selection[0].XenObject.opaque_ref);

                    if (vmRefInGroup != null)
                    {
                        var vmRefs = new List <XenRef <VM> > {
                            vmRefInGroup
                        };
                        VMGroup <T> .RemoveVMsFromGroupAction(_group, vmRefs).RunAsync();

                        return;
                    }
                }

                if (!ChangesOK(selection.AsXenObjects <VM>(), _group, _group.Name))
                {
                    return;
                }

                var selectedRefVMs = selection.AsXenObjects().ConvertAll <XenRef <VM> >(converterVMRefs);

                selectedRefVMs.AddRange(VMGroup <T> .GroupToVMs(_group));
                VMGroup <T> .AssignVMsToGroupAction(_group, selectedRefVMs).RunAsync();
            }
Ejemplo n.º 2
0
 public override AsyncAction SaveSettings()
 {
     return(VMGroup <T> .AssignVMsToGroupAction(_clone, SelectedVMsRefs, true));
 }