/// <summary>
        /// Updates the current drag state.
        /// </summary>
        /// <param name="dropInfo">
        ///  Information about the drag operation.
        /// </param>
        /// <remarks>
        /// To allow a drop at the current drag position, the <see cref="DropInfo.Effects"/> property on
        /// <paramref name="dropInfo"/> should be set to a value other than <see cref="DragDropEffects.None"/>
        /// and <see cref="DropInfo.Payload"/> should be set to a non-null value.
        /// </remarks>
        public void DragOver(IDropInfo dropInfo)
        {
            if (dropInfo.Payload is Category category)
            {
                dropInfo.Effects = CategoryApplicationValidationService.ValidateDragDrop(this.Session.PermissionService, this.Thing, category, logger);
                return;
            }

            dropInfo.Effects = DragDropEffects.None;
        }
Example #2
0
        /// <summary>
        /// Set the <see cref="IDropInfo.Effects"/> when the payload is an <see cref="Category"/>
        /// </summary>
        /// <param name="dropInfo">The <see cref="IDropInfo"/></param>
        /// <param name="category">The <see cref="Category"/> to drop</param>
        protected void DragOver(IDropInfo dropInfo, Category category)
        {
            //if (!this.PermissionService.CanWrite(this.Thing) || this.Thing.Category.Contains(category) || !category.PermissibleClass.Contains(this.Thing.ClassKind))
            //{
            //    dropInfo.Effects = DragDropEffects.None;
            //    return;
            //}

            //dropInfo.Effects = DragDropEffects.Copy;

            dropInfo.Effects = CategoryApplicationValidationService.ValidateDragDrop(this.Session.PermissionService, this.Thing, category, logger);
        }
        /// <summary>
        /// Updates the current drag state.
        /// </summary>
        /// <param name="dropInfo">
        ///  Information about the drag operation.
        /// </param>
        /// <remarks>
        /// To allow a drop at the current drag position, the <see cref="DropInfo.Effects"/> property on
        /// <paramref name="dropInfo"/> should be set to a value other than <see cref="DragDropEffects.None"/>
        /// and <see cref="DropInfo.Payload"/> should be set to a non-null value.
        /// </remarks>
        public void DragOver(IDropInfo dropInfo)
        {
            if (dropInfo.Payload is Category category)
            {
                dropInfo.Effects = CategoryApplicationValidationService.ValidateDragDrop(this.Session.PermissionService, this.Thing, category, logger);
                return;
            }

            var termPayload = dropInfo.Payload as Term;
            var canDropTerm = this.PermissionService.CanWrite(ClassKind.Term, this.Thing);

            if (termPayload == null || !canDropTerm)
            {
                dropInfo.Effects = DragDropEffects.None;
                return;
            }

            if (termPayload.Container == this.Thing)
            {
                dropInfo.Effects = DragDropEffects.None;
                return;
            }

            if (termPayload.IDalUri.ToString() == this.Session.DataSourceUri)
            {
                // Move only possible within the glossary of the same chain of rdl
                var payloadRdl      = (ReferenceDataLibrary)termPayload.Container.GetContainerOfType(typeof(ReferenceDataLibrary));
                var possibleNewRdls = payloadRdl.GetRequiredRdls().ToList();
                possibleNewRdls.Add(payloadRdl);

                var currentRdl = (ReferenceDataLibrary)this.Thing.Container;
                if (!possibleNewRdls.Contains(currentRdl))
                {
                    dropInfo.Effects = DragDropEffects.None;
                    return;
                }

                dropInfo.Effects = DragDropEffects.Move;
                return;
            }

            // different data-source
            dropInfo.Effects = DragDropEffects.Copy;
        }
Example #4
0
 /// <summary>
 /// Set the <see cref="IDropInfo.Effects" /> when the payload is an <see cref="Category" />
 /// </summary>
 /// <param name="dropInfo">The <see cref="IDropInfo" /></param>
 /// <param name="category">The <see cref="Category" /> to drop</param>
 protected void DragOver(IDropInfo dropInfo, Category category)
 {
     dropInfo.Effects = CategoryApplicationValidationService.ValidateDragDrop(this.Session.PermissionService, this.Thing, category, logger);
 }