Esempio n. 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    workflowActivityID = ((ManualActivity)(this.ModelItem.Source.ComputedValue)).WorkflowActivityID;

            ManualActivityGuide manualActivity = new ManualActivityGuide();

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

            bool?result = manualActivity.ShowDialog();

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

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

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

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

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

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

                this.ModelItem.Properties["WorkflowActivityID"].SetValue(manualActivity.WorkflowActivityID);
            }
        }
Esempio n. 2
0
        public Activity Create(DependencyObject target)
        {
            ManualActivityGuide customActivityGuide = new ManualActivityGuide();
            bool?result = customActivityGuide.ShowDialog();

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

                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);
        }