/// <summary> /// Ends dragging of an object by attaching it to the given connector. /// </summary> /// <param name="target">The connector for attaching of a dragging object.</param> public void Drop(IUriPlacementConnector target) { var dragged = this._connected; target.Connect(dragged); this._uriDisconnectTable[dragged] = target; this._connected = null; this._data.Clear(); }
/// <summary> /// Tries to make the object resolved via the URI available in the shell. /// </summary> /// <param name="uri">The URI of the resolved object.</param> /// <param name="resolved">The object resolved via the URI.</param> /// <param name="placementConnector"><see cref="IUriPlacementConnector"/> /// for connecting the object to the user interface.</param> /// <param name="appendToDisposable">When this method returns, contains the action that allows to add a <see cref="IDisposable"/> /// to the group of <see cref="IDisposable"/> in the metadata.</param> /// <returns><see cref="IDisposable"/> registered in the metadata.</returns> private IDisposable Connect(Uri uri, object resolved, IUriPlacementConnector placementConnector, out Action <IDisposable> appendToDisposable) { placementConnector.Connect(resolved); try { var composite = new CompositeDisposable(); appendToDisposable = composite.Add; this._uriResolvedObjectHolder.Add(resolved, new UriResolvedMetadata(uri, composite)); this._uriDisconnectTable[resolved] = placementConnector; return(composite); } catch (Exception ex) { if (!ex.IsCritical()) { // When failed to add the object in the holder - disconnect it from the UI. placementConnector.Disconnect(resolved); } throw; } }