public void Drop(IDropInfo dropInfo) { if (dropInfo.Data is TECSubScope subScope) { SelectedVM = new AddSubScopeVM(toAdd => { scopeManager.Templates.SubScopeTemplates.Add(toAdd); }, scopeManager); ((AddSubScopeVM)SelectedVM).SetTemplate(subScope); } else if (dropInfo.Data is TECPoint point) { SelectedVM = new AddPointVM(SelectedSubScope, scopeManager); ((AddPointVM)SelectedVM).SetTemplate(point); } else if (dropInfo.Data is IEndDevice) { DragDropHelpers.Drop(dropInfo, obj => SelectedSubScope.AddDevice((obj as IDragDropable).DropData() as IEndDevice), false); } }
private void addPointExecute(TECSubScope subScope) { SelectedVM = new AddPointVM(subScope, scopeManager); }
public void Drop(IDropInfo dropInfo) { if (dropInfo.VisualTarget == dropInfo.DragInfo.VisualSource) { DragDropHelpers.Drop(dropInfo, x => { return(x); }); } else { object dropped = null; if (!IsTemplates && dropInfo.Data is IDragDropable dropable) { dropped = dropable.DropData(); } else { dropped = dropInfo.Data; } if (dropped is TECEquipment equipment) { SelectedVM = new AddEquipmentVM(SelectedSystem, scopeManager); (SelectedVM as AddEquipmentVM).Added = equip => { SelectedEquipment = equip as TECEquipment; }; ((AddEquipmentVM)SelectedVM).SetTemplate(equipment); } else if (dropped is TECSubScope subScope) { SelectedVM = new AddSubScopeVM(SelectedEquipment, scopeManager); (SelectedVM as AddSubScopeVM).Added = ss => { SelectedSubScope = ss as TECSubScope; }; ((AddSubScopeVM)SelectedVM).SetTemplate(subScope); ((AddSubScopeVM)SelectedVM).SetParentSystem(SelectedSystem, scopeManager); } else if (dropped is TECPoint point) { SelectedVM = new AddPointVM(SelectedSubScope, scopeManager); ((AddPointVM)SelectedVM).SetTemplate(point); } else if (dropped is IEndDevice) { DragDropHelpers.Drop(dropInfo, obj => SelectedSubScope.AddDevice((obj as IDragDropable).DropData() as IEndDevice), false); } else if (dropped is TECMisc || dropped is TECCost) { TECMisc misc = dropped as TECMisc; SelectedVM = new AddMiscVM(SelectedSystem, scopeManager); TECMisc newMisc = misc != null ? new TECMisc(misc) : new TECMisc(dropped as TECCost); ((AddMiscVM)SelectedVM).SetTemplate(misc); } else if (dropped is TECSystem system) { SelectedVM = new AddSystemVM(scopeManager); (SelectedVM as AddSystemVM).Added = sys => { SelectedSystem = sys as TECSystem; }; ((AddSystemVM)SelectedVM).SetTemplate(system); } } }