private void MoveToGroup(object item) { ObservableCollection <object> tree = new ObservableCollection <object> (); tree.Add(VMModel.GetInstance().RootVMGroup); MoveToGroupDialog dlg = new MoveToGroupDialog(tree); dlg.Owner = Window1.GetWindow(View.Parent); dlg.ShowDialog(); if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) { //only VMGroup selected VMGroup group = dlg.CheckedItem as VMGroup; if ((item is VMGroup) && (ActiveVMList.Count == 0)) { model.MoveToGroup(item as VMGroup, group); group.Save(); } else {//Some VM in Group selected or single VM is selected on tree model.MoveToGroup(ActiveVMList, group); model.ActiveVMList.Clear(); group.Save(); } } }
private void MoveToGroup(object selectedItem) { ObservableCollection <object> tree = new ObservableCollection <object>(); tree.Add(vmHostModel.RootVMHostGroup); MoveToGroupDialog dlg = new MoveToGroupDialog(tree); dlg.Owner = Window1.GetWindow(View.Parent); dlg.ShowDialog(); if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) { //only VMHostGroup selected VMHostGroup group = dlg.CheckedItem as VMHostGroup; if ((this.SelectedItem is VMHostGroup) && (vmHostModel.ActiveVMHostList.Count == 0)) { vmHostModel.MoveToGroup(this.SelectedItem as VMHostGroup, group); group.Save(); } else {//Some Host in Group selected or single Host is selected on tree vmHostModel.MoveToGroup(vmHostModel.ActiveVMHostList, group); vmHostModel.ActiveVMHostList.Clear(); group.Save(); } } }