Beispiel #1
0
        public void BeginDragAndDrop(CoreDragInfo info, ICoreDropOperationTarget?target = null)
        {
            if (
#if __WASM__
                _window.Dispatcher.IsThreadingSupported&&
#endif
                !_window.Dispatcher.HasThreadAccess)
            {
                _window.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => BeginDragAndDrop(info, target));
                return;
            }

            if (!AreConcurrentOperationsEnabled)
            {
                foreach (var pending in _dragOperations.ToArray())
                {
                    pending.Abort();
                }
            }

            RegisterWindowHandlers();

            var op = new DragOperation(_window, _hostExtension, info, target);

            _dragOperations.Add(op);
            info.RegisterCompletedCallback(_ => _dragOperations.Remove(op));
        }