private void ExecuteOrderChangeCommand(object parameter) { var dropobj = parameter as ProfileModel; if (dropobj.GroupNo == _draggedObject.GroupNo && _draggedObject.Comment == "Pallet") { //remove the drag object and re-insert it PalletList.Remove(_draggedObject); var idx = PalletList.IndexOf(dropobj); PalletList.Insert(idx, _draggedObject); } else { //delete the item from drag list if (13.Equals(_draggedObject.GroupNo)) { Group1x3.Remove(_draggedObject); } else if (26.Equals(_draggedObject.GroupNo)) { Group2x6.Remove(_draggedObject); } else if (45.Equals(_draggedObject.GroupNo)) { Group4x5.Remove(_draggedObject); } else if (123456.Equals(_draggedObject.GroupNo)) { Brothers.Remove(_draggedObject); } } }
private void ExecuteDropCommand(object parameter) { Action <ObservableCollection <ProfileModel>, int> listAdd = (group, groupid) => { var dragobj = _draggedObject.Clone(); dragobj.GroupNo = groupid; group.Add(dragobj as ProfileModel); if (13.Equals(_draggedObject.GroupNo)) { Group1x3.Remove(_draggedObject); } else if (26.Equals(_draggedObject.GroupNo)) { Group2x6.Remove(_draggedObject); } else if (45.Equals(_draggedObject.GroupNo)) { Group4x5.Remove(_draggedObject); } else if (123456.Equals(_draggedObject.GroupNo)) { Brothers.Remove(_draggedObject); } _draggedObject = null; }; if ("1x3".Equals(parameter)) { listAdd(Group1x3, 13); } else if ("2x6".Equals(parameter)) { listAdd(Group2x6, 26); } else if ("4x5".Equals(parameter)) { listAdd(Group4x5, 45); } else { listAdd(Brothers, 123456); } _draggedObject = null; }