コード例 #1
0
ファイル: DependencyObject.cs プロジェクト: stanasse/olive
        private Activity GetActivityByClassName(Activity start_activity, string name)
        {
            List <Activity> list    = new List <Activity> ();
            Activity        current = start_activity.GetRootActivity();

            while (current != null)
            {
                // TODO: Path + Name
                if (name.Equals(current.GetType().Name))
                {
                    return(current);
                }

                if (Activity.IsBasedOnType(current, typeof(CompositeActivity)))
                {
                    CompositeActivity composite = (CompositeActivity)current;
                    foreach (Activity activity in composite.Activities)
                    {
                        list.Add(activity);
                    }
                }

                if (list.Count == 0)
                {
                    break;
                }

                current = list [0];
                list.Remove(current);
            }

            return(null);
        }