Пример #1
0
        /// <summary>
        /// Cancels the drag &amp; 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;
        }
Пример #2
0
        /// <summary>
        /// Commits the drag &amp; 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;
        }
Пример #3
0
        private void OnContainerTransactionStarted(object sender, DraggableTransaction <TItem> e)
        {
            if (GetApplyDropClassesOnDragStarted())
            {
                var dropResult = ItemCanBeDropped();

                dropAllowed = dropResult.Item2;
            }

            InvokeAsync(StateHasChanged);
        }
Пример #4
0
        /// <summary>
        /// Starts the new drag &amp; 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);
        }