private void descriptorEditor_SaveButtonClicked(object sender, EventArgs e)
		{
			if (this.descriptorEditor.CurrentProcess != null)
			{
				WfActivityDescriptor activityTemplate = new WfActivityDescriptor(
					this.descriptorEditor.CurrentProcessDescriptor.FindNotUsedActivityKey(),
					WfActivityType.NormalActivity);

				activityTemplate.Properties.ReplaceExistedPropertyValues(this.propertyGrid.Properties);

				this.descriptorEditor.CurrentProcessDescriptor.Activities.Add(activityTemplate);

				if (this.descriptorEditor.CurrentProcessDescriptor.IsMainStream == false)
					WfActivityBase.CreateActivityInstance(activityTemplate, this.descriptorEditor.CurrentProcess);

				WfAdminAddActivityExecutor executor = new WfAdminAddActivityExecutor(
					this.descriptorEditor.CurrentProcess.CurrentActivity,
					this.descriptorEditor.CurrentProcess,
					this.FromActivity,
					activityTemplate,
					this.syncMSObj.Checked);

				executor.Execute();
			}
		}
		public void BasicAdminAddActivityWithMainStreamAndFromActivityExecutorTest()
		{
			IWfProcess process = WfProcessTestCommon.StartupSimpleProcess();

			const string targetName = "修改后的名称";

			IWfActivityDescriptor targetDesp = new WfActivityDescriptor(process.Descriptor.FindNotUsedActivityKey(), WfActivityType.NormalActivity);

			targetDesp.Properties.SetValue("Name", targetName);
			process.Descriptor.Activities.Add(targetDesp);

			WfActivityBase.CreateActivityInstance(targetDesp, process);

			IWfActivity fromActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

			WfAdminAddActivityExecutor executor = new WfAdminAddActivityExecutor(process.CurrentActivity, process, fromActivity.Descriptor, targetDesp, true);

			executor.Execute();

			process = WfRuntime.GetProcessByProcessID(process.ID);

			targetDesp = process.Descriptor.Activities[targetDesp.Key];

			Assert.IsNotNull(targetDesp);
			Assert.AreEqual(targetName, targetDesp.Properties.GetValue("Name", string.Empty));
			fromActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

			Assert.IsNotNull(fromActivity.Descriptor.ToTransitions.GetTransitionByToActivity(targetDesp));

			IWfActivityDescriptor msActDesp = targetDesp.Instance.GetMainStreamActivityDescriptor();
			Assert.IsNotNull(msActDesp);
			Assert.AreEqual(process.MainStream, msActDesp.Process);
			Assert.AreEqual(targetName, msActDesp.Properties.GetValue("Name", string.Empty));

			IWfActivityDescriptor msFromActDesp = fromActivity.GetMainStreamActivityDescriptor();

			Assert.IsNotNull(msFromActDesp);
			Assert.AreEqual(process.MainStream, msFromActDesp.Process);
			Assert.IsNotNull(msFromActDesp.ToTransitions.GetTransitionByToActivity(msActDesp));
		}
		public void BasicAdminAddActivityExecutorTest()
		{
			IWfProcess process = WfProcessTestCommon.StartupSimpleProcess();

			const string targetName = "修改后的名称";

			IWfActivityDescriptor targetDesp = new WfActivityDescriptor(process.Descriptor.FindNotUsedActivityKey(), WfActivityType.NormalActivity);

			targetDesp.Properties.SetValue("Name", targetName);
			process.Descriptor.Activities.Add(targetDesp);

			WfActivityBase.CreateActivityInstance(targetDesp, process);

			WfAdminAddActivityExecutor executor = new WfAdminAddActivityExecutor(process.CurrentActivity, process, null, targetDesp, false);

			executor.Execute();

			process = WfRuntime.GetProcessByProcessID(process.ID);

			targetDesp = process.Descriptor.Activities[targetDesp.Key];

			Assert.IsNotNull(targetDesp);
			Assert.AreEqual(targetName, targetDesp.Properties.GetValue("Name", string.Empty));
		}