private static void DoEditorOperation_Paste(TimelinableTrackBase[] tracks) { if (tracks.IsNullOrEmpty()) { return; } using (var d = new DelayEditHandlerScope(null)) { foreach (var track in tracks) { foreach (var itemInfo in track.itemInfoes) { if (itemInfo.isSelected) { var _itemInfo = itemInfo; //形成闭包 var _track = track; d.ToCallback(() => { var addItemInfo = _itemInfo.GetType().CreateInstance <TimelinableItemInfoBase>(); addItemInfo.CopyFrom(_itemInfo); addItemInfo.time = _track.curTime; _track.AddItemInfo(addItemInfo); }); } } } } }
private static void DoEditorOperation_Delete(TimelinableTrackBase[] tracks) { if (tracks.IsNullOrEmpty()) { return; } using (var d = new DelayEditHandlerScope(null)) { foreach (var track in tracks) { foreach (var itemInfo in track.itemInfoes) { if (itemInfo.isSelected) { var _itemInfo = itemInfo; //形成闭包 var _track = track; //形成闭包 d.ToCallback(() => { _track.RemoveItemInfo(_itemInfo); }); } } } } }