/// <summary>
        /// 初始化用户输入框
        /// </summary>
        /// <param name="container"></param>
        private void InitActivitiesListBox(HtmlSelect activitiesList)
        {
            RejectActivityList activities = RejectActivityList.CreateFromProcess(WfClientContext.Current.CurrentActivity.Process);

            ListItemCollection list = new ListItemCollection();

            for (int i = activities.Count - 1; i >= 0; i--)
            {
                IWfActivity activity = activities[i];

                if (activity.Descriptor.Properties.GetValue("AllowToBeReturned", true))
                {
                    WfControlNextStep nextSetp = new WfControlNextStep(activity);

                    string displayName = string.Empty;

                    if (activity.Operator != null)
                    {
                        displayName = activity.Operator.DisplayName;
                    }
                    else
                    {
                        if (activity.Assignees.Count > 0)
                        {
                            displayName = activity.Assignees[0].User.DisplayName;
                        }
                        else
                        {
                            displayName = Translator.Translate(Define.DefaultCulture, "自动流转点");
                        }
                    }

                    WfMoveToControl.DoActionAfterRegisterContextConverter(() =>
                    {
                        ListItem item = new ListItem(string.Format("{0} - {1}({2})", displayName, activity.Descriptor.Name, activity.Descriptor.Key),
                                                     JSONSerializerExecute.Serialize(nextSetp));
                        list.Add(item);
                    }
                                                                          );
                }
            }

            if (list.Count > 0)
            {
                foreach (ListItem item in list)
                {
                    this._ActivitiesList.Items.Add(item);
                }
            }
            else
            {
                this._ActivitiesList.Items.Add(Translator.Translate(Define.DefaultCulture, "没有能够退回的环节"));
                this._ActivitiesList.Disabled = true;
            }

            this._ActivitiesList.Multiple = true;
        }
        public static RejectActivityList CreateFromProcess(IWfProcess process)
        {
            RejectActivityList result = null;

            if (process.MainStream != null)
            {
                result = CreateFromProcessWithMainStream(process);
            }
            else
            {
                result = OldCreateFromProcessWithoutMainStream(process);
            }

            return(result);
        }
        /// <summary>
        /// 这是兼容于旧流程的处理方式
        /// </summary>
        /// <param name="process"></param>
        /// <returns></returns>
        private static RejectActivityList OldCreateFromProcessWithoutMainStream(IWfProcess process)
        {
            RejectActivityList result = new RejectActivityList();

            for (int i = process.ElapsedActivities.Count - 1; i >= 0; i--)
            {
                IWfActivity activity = process.ElapsedActivities[i];

                if (activity.Descriptor.IsReturnSkipped == false &&
                    activity.Descriptor.GetAssociatedActivity() != process.CurrentActivity.Descriptor.GetAssociatedActivity())
                {
                    if (result.ContainsKey(activity.Descriptor.GetAssociatedActivity().Key) == false)
                    {
                        result.Add(activity);
                    }
                }
            }

            return(result);
        }
        private static RejectActivityList CreateFromProcessWithMainStream(IWfProcess process)
        {
            RejectActivityList result = new RejectActivityList();

            string currentMainStreamKey = process.CurrentActivity.MainStreamActivityKey;

            for (int i = process.ElapsedActivities.Count - 1; i >= 0; i--)
            {
                IWfActivity activity = process.ElapsedActivities[i];

                if (activity.MainStreamActivityKey.IsNotEmpty() &&
                    activity.Descriptor.AssociatedActivityKey.IsNullOrEmpty() &&
                    currentMainStreamKey.IsNotEmpty() && activity.MainStreamActivityKey != currentMainStreamKey)
                {
                    if (result.ContainsKey(activity.Descriptor.GetAssociatedActivity().Key) == false)
                    {
                        result.Add(activity);
                    }
                }
            }

            return(result);
        }