public AssetViewModel(AssetTreeExViewModel tva, TVAssetViewModel obj) { original = obj; atvm = tva; Asset = GetAsset(original.Asset.ID); LoadViewSettings(original.Asset.ID); IsError = false; }
/// <summary> /// Drop data into this ViewModel /// </summary> void IDropable.Drop(object data, int index) { if (data is TVAssetViewModel source) { if (source.Asset.ParentAssetID == 0 && Customer.ID == source.Asset.CustomerID) //if dragged and dropped yourself, don't need to do anything { return; } SQLiteQueries.UpdateParentAssetID(source.Asset.ID, 0, Customer.ID); AssetTreeExViewModel.MoveAsset(source.Asset.ID, 0, Customer.ID); } }
/// <summary> /// Drop data into this ViewModel /// </summary> void IDropable.Drop(object data, int index) { //if moving within customer, reassign the children to the //level above first if (data is TVAssetViewModel source) { if (source.Asset.ID == Asset.ID || source.Asset.ParentAssetID == Asset.ID) //if dragged and dropped yourself, don't need to do anything { return; } SQLiteQueries.UpdateParentAssetID(source.Asset.ID, Asset.ID, Asset.CustomerID); AssetTreeExViewModel.MoveAsset(source.Asset.ID, Asset.ID, Asset.CustomerID); } }