Exemple #1
0
        public bool OnCodeActivityAdded()
        {
            CodeActivity codeActivity = new CodeActivity();

            ActivityProperties activityPropertiesForm = new ActivityProperties();

            activityPropertiesForm.ShowDialog();
            if (activityPropertiesForm.Result == DialogResult.OK)
            {
                foreach (Activity activity in this.rootActivity.Activities)
                {
                    if (activity.Name.Equals(activityPropertiesForm.ActivityName, StringComparison.OrdinalIgnoreCase))
                    {
                        MessageBox.Show(this.parent, "Cannot add new CodeActivity. The CodeActivity with name '" + activityPropertiesForm.ActivityName + "' already exists.", this.parent.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                }

                codeActivity.Name        = activityPropertiesForm.ActivityName;
                codeActivity.Description = activityPropertiesForm.Description;

                this.rootActivity.Activities.Add(codeActivity);
                this.designerHost.RootComponent.Site.Container.Add(codeActivity);
                this.workflowView.Update();
            }

            return(true);
        }
Exemple #2
0
        public bool OnCodeActivityAdded()
        {

            CodeActivity codeActivity = new CodeActivity();

            ActivityProperties activityPropertiesForm = new ActivityProperties();
            activityPropertiesForm.ShowDialog();
            if (activityPropertiesForm.Result == DialogResult.OK)
            {
                foreach (Activity activity in this.rootActivity.Activities)
                {
                    if (activity.Name.Equals(activityPropertiesForm.ActivityName, StringComparison.OrdinalIgnoreCase))
                    {
                        MessageBox.Show(this.parent, "Cannot add new CodeActivity. The CodeActivity with name '" + activityPropertiesForm.ActivityName + "' already exists.", this.parent.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return false;
                    }
                }

                codeActivity.Name = activityPropertiesForm.ActivityName;
                codeActivity.Description = activityPropertiesForm.Description;

                this.rootActivity.Activities.Add(codeActivity);
                this.designerHost.RootComponent.Site.Container.Add(codeActivity);
                this.workflowView.Update();
            }

            return true;
        }