Exemplo n.º 1
0
        /// <summary>
        /// Performs the drop operation
        /// </summary>
        /// <param name="dropInfo">
        /// Information about the drop operation.
        /// </param>
        public async Task Drop(IDropInfo dropInfo)
        {
            if (this.ThingCreator == null)
            {
                this.ThingCreator = new ThingCreator();
            }

            var parameterTypeAndScale = dropInfo.Payload as Tuple <ParameterType, MeasurementScale>;

            if (parameterTypeAndScale != null)
            {
                await this.Drop(dropInfo, parameterTypeAndScale);
            }

            var elementDefinition = dropInfo.Payload as ElementDefinition;

            if (elementDefinition != null)
            {
                await this.Drop(dropInfo, elementDefinition);
            }

            // moving
            var parameter = dropInfo.Payload as Parameter;

            if (parameter != null)
            {
                await this.Drop(dropInfo, parameter);
            }

            // moving the group right under the element definition
            var group = dropInfo.Payload as ParameterGroup;

            if (group != null)
            {
                await this.Drop(dropInfo, group);
            }

            var category = dropInfo.Payload as Category;

            if (category != null)
            {
                await this.Drop(dropInfo, category);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs the drop operation
        /// </summary>
        /// <param name="dropInfo">
        /// Information about the drop operation.
        /// </param>
        public async Task Drop(IDropInfo dropInfo)
        {
            //TODO: Add Permission handling

            var rule = dropInfo.Payload as Rule;

            if (rule != null)
            {
                if (this.ThingCreator == null)
                {
                    this.ThingCreator = new ThingCreator();
                }

                try
                {
                    await this.ThingCreator.CreateUserRuleVerification(this.Thing, rule, this.Session);
                }
                catch (Exception ex)
                {
                    this.ErrorMsg = ex.Message;
                }
            }

            var builtInRuleMetaData = dropInfo.Payload as IBuiltInRuleMetaData;

            if (builtInRuleMetaData != null)
            {
                if (this.ThingCreator == null)
                {
                    this.ThingCreator = new ThingCreator();
                }

                try
                {
                    await this.ThingCreator.CreateBuiltInRuleVerification(this.Thing, builtInRuleMetaData.Name, this.Session);
                }
                catch (Exception ex)
                {
                    this.ErrorMsg = ex.Message;
                }
            }

            dropInfo.Effects = DragDropEffects.None;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handle the drop of a <see cref="ElementDefinition"/>
        /// </summary>
        /// <param name="dropInfo">The <see cref="IDropInfo"/> containing the payload</param>
        /// <param name="elementDefinition">The <see cref="ElementDefinition"/></param>
        private async Task Drop(IDropInfo dropInfo, ElementDefinition elementDefinition)
        {
            if (this.ThingCreator == null)
            {
                this.ThingCreator = new ThingCreator();
            }

            try
            {
                var currentDomain = this.Session.QuerySelectedDomainOfExpertise(this.Thing.GetContainerOfType <Iteration>());
                if (elementDefinition.TopContainer == this.Thing.TopContainer)
                {
                    await this.ThingCreator.CreateElementUsage(this.Thing, elementDefinition, currentDomain, this.Session);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                this.ErrorMsg = ex.Message;
            }
        }