本文整理汇总了C#中Activity.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.GetPropertyValue方法的具体用法?C# Activity.GetPropertyValue怎么用?C# Activity.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity.GetPropertyValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeAddActivity
///// <summary>
///// 添加或修改活动
///// </summary>
///// <param name="activity"></param>
//public void SafeAddActivity(Activity activity)
//{
// if (this.Activities == null)
// {
// this.Activities = new List<Activity>();
// }
// Activity old = Activities.FirstOrDefault(a => a.ID == activity.ID);
// if (old != null)
// {
// this.Activities.Remove(old);
// }
// //if (activity.Parent != this)
// //{
// // activity.Parent = this;
// //}
// this.Activities.Add(activity);
// this.Transitions.ForEach(a =>
// {
// if (a.SrcActivity.ID == activity.ID)
// {
// a.SrcActivity = activity;
// }
// if (a.DestActivity.ID == activity.ID)
// {
// a.DestActivity = activity;
// }
// });
//}
/// <summary>
/// 添加或修改活动
/// </summary>
/// <param name="oldActivityID"></param>
/// <param name="activity"></param>
public void SafeAddActivity(string oldActivityID, Activity activity)
{
if (this.Activities == null)
{
this.Activities = new List<Activity>();
}
ProcessDefine parent = activity.GetPropertyValue<ProcessDefine>("Parent");
if (parent == null)
{
activity.SetPropertyValue("Parent", this);
}
this.Transitions.ForEach(a =>
{
if (a.SrcActivity == oldActivityID)
{
a.SrcActivity = activity.ID;
}
if (a.DestActivity == oldActivityID)
{
a.DestActivity = activity.ID;
}
});
int index = -1;
for (int i = 0; i < Activities.Count; i++)
{
if (Activities[i].ID == oldActivityID)
{
index = i;
break;
}
}
if (index != -1)
{
activity.Style = Activities[index].Style;
Activities.RemoveAt(index);
Activities.Insert(index, activity);
}
else
{
Activities.Add(activity);
}
}