Example #1
0
        private void ActivityDesigner_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int    type         = ((System.Activities.Expressions.Literal <int>)(((this.ModelItem.Properties["Type"].Value).Content).ComputedValue)).Value;
            int    item         = ((System.Activities.Expressions.Literal <int>)(((this.ModelItem.Properties["Item"].Value).Content).ComputedValue)).Value;
            int    position     = ((System.Activities.Expressions.Literal <int>)(((this.ModelItem.Properties["Position"].Value).Content).ComputedValue)).Value;
            string command      = ((System.Activities.Expressions.Literal <string>)(((this.ModelItem.Properties["Command"].Value).Content).ComputedValue)).Value;
            string expression   = ((System.Activities.Expressions.Literal <string>)(((this.ModelItem.Properties["Expression"].Value).Content).ComputedValue)).Value;
            string description  = ((System.Activities.Expressions.Literal <string>)(((this.ModelItem.Properties["Description"].Value).Content).ComputedValue)).Value;
            int    wfActivityID = ((BackToActor)(this.ModelItem.Source.ComputedValue)).WorkflowActivityID;

            BackToActorGuide backToActor = new BackToActorGuide();

            backToActor.Type               = type;
            backToActor.Item               = item;
            backToActor.Position           = position;
            backToActor.Command            = command;
            backToActor.Expression         = expression;
            backToActor.Description        = description;
            backToActor.WorkflowActivityID = wfActivityID;

            bool?result = backToActor.ShowDialog();

            if (result == true)
            {
                System.Activities.InArgument <int> typeArg = new System.Activities.InArgument <int>();
                typeArg = Convert.ToInt32(backToActor.cbxTypes.SelectedValue);
                this.ModelItem.Properties["Type"].SetValue(typeArg);

                System.Activities.InArgument <int> itemArg = new System.Activities.InArgument <int>();
                itemArg = Convert.ToInt32(backToActor.cbxItems.SelectedValue);
                this.ModelItem.Properties["Item"].SetValue(itemArg);

                System.Activities.InArgument <int> positionArg = new System.Activities.InArgument <int>();
                positionArg = Convert.ToInt32(backToActor.cbxPosition.SelectedValue);
                this.ModelItem.Properties["Position"].SetValue(positionArg);

                System.Activities.InArgument <string> commandArg = new System.Activities.InArgument <string>();
                commandArg = backToActor.txtCmd.Text;
                this.ModelItem.Properties["Command"].SetValue(commandArg);

                System.Activities.InArgument <string> expressionArg = new System.Activities.InArgument <string>();
                expressionArg = backToActor.Expression;
                this.ModelItem.Properties["Expression"].SetValue(expressionArg);

                System.Activities.InArgument <string> descriptionArg = new System.Activities.InArgument <string>();
                descriptionArg = backToActor.txtDescription.Text;
                this.ModelItem.Properties["Description"].SetValue(descriptionArg);

                this.ModelItem.Properties["WorkflowActivityID"].SetValue(backToActor.WorkflowActivityID);
            }
        }
        public Activity Create(DependencyObject target)
        {
            BackToActorGuide customActivityGuide = new BackToActorGuide();
            bool?            result = customActivityGuide.ShowDialog();

            if (result == true)
            {
                BackToActor activity = new BackToActor();

                activity.DisplayName = "退回到发起人";

                activity.Type               = Convert.ToInt32(customActivityGuide.cbxTypes.SelectedValue);
                activity.Item               = Convert.ToInt32(customActivityGuide.cbxItems.SelectedValue);
                activity.Position           = customActivityGuide.cbxPosition.SelectedValue == null ? -99 : Convert.ToInt32(customActivityGuide.cbxPosition.SelectedValue);
                activity.Command            = customActivityGuide.txtCmd.Text;
                activity.Expression         = customActivityGuide.Expression;
                activity.Description        = customActivityGuide.txtDescription.Text;
                activity.WorkflowActivityID = customActivityGuide.WorkflowActivityID;

                VisualBasicValue <int> workflowfInstanceIDParams = new VisualBasicValue <int>();
                workflowfInstanceIDParams.ExpressionText = "WorkflowInstanceID";
                activity.WorkflowInstanceID = workflowfInstanceIDParams;

                activity.ExchangeParams = new VisualBasicReference <Dictionary <string, object> > {
                    ExpressionText = "ExchangeParams"
                };
                activity.FirstActor = new VisualBasicValue <string> {
                    ExpressionText = "FirstActor"
                };
                activity.LastActor = new VisualBasicReference <string> {
                    ExpressionText = "LastActor"
                };

                return(activity);
            }
            return(null);
        }