/// <summary> /// Cancels the drag & drop transaction. /// </summary> /// <returns>A task that represents the asynchronous operation.</returns> public async Task CancelTransaction() { await transaction.Cancel(); TransactionEnded?.Invoke(this, EventArgs.Empty); transaction = null; }
/// <summary> /// Commits the drag & drop transaction. /// </summary> /// <param name="dropZoneName">Dropzone name that is the source of the drag operation.</param> /// <returns>A task that represents the asynchronous operation.</returns> public async Task CommitTransaction(string dropZoneName) { await transaction.Commit(); await ItemDropped.InvokeAsync(new DraggableDroppedEventArgs <TItem>(transaction.Item, dropZoneName)); TransactionEnded?.Invoke(this, EventArgs.Empty); transaction = null; }
private void OnContainerTransactionStarted(object sender, DraggableTransaction <TItem> e) { if (GetApplyDropClassesOnDragStarted()) { var dropResult = ItemCanBeDropped(); dropAllowed = dropResult.Item2; } InvokeAsync(StateHasChanged); }
/// <summary> /// Starts the new drag & drop transaction for the specified item and dropzone. /// </summary> /// <param name="item">Item that is being dragged.</param> /// <param name="sourceZoneName">Dropzone name that is the source of the drag operation.</param> /// <param name="commited">Callback that will be called after the successful transaction.</param> /// <param name="canceled">Callback that will be called when the transaction has been cancelled.</param> public void StartTransaction(TItem item, string sourceZoneName, Func <Task> commited, Func <Task> canceled) { transaction = new DraggableTransaction <TItem>(item, sourceZoneName, commited, canceled); TransactionStarted?.Invoke(this, transaction); }