internal static ReadOnlyCollection<DesignerView> GetViews(StructuredCompositeActivityDesigner designer)
        {
            Debug.Assert(designer.Activity != null);
            if (designer.Activity == null)
                throw new ArgumentException("Component can not be null!");

            bool locked = !designer.IsEditable;

            //Get all the possible view types
            List<object[]> viewTypes = new List<object[]>();

            string displayName = ActivityToolboxItem.GetToolboxDisplayName(designer.Activity.GetType());
            viewTypes.Add(new object[] { designer.Activity.GetType(), DR.GetString(DR.ViewActivity, displayName) });

            //Only show the views in workflow designer or for nested activities
            if (designer.Activity.Site != null)
            {
                WorkflowDesignerLoader loader = designer.Activity.Site.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                Type activityType = designer.Activity.GetType();

                if (loader == null ||
                    (typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                    (!locked || FindActivity(designer, typeof(CancellationHandlerActivity)) != null)))
                    viewTypes.Add(new object[] { typeof(CancellationHandlerActivity), DR.GetString(DR.ViewCancelHandler) });

                if (loader == null ||
                    (typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                    (!locked || FindActivity(designer, typeof(FaultHandlersActivity)) != null)))
                    viewTypes.Add(new object[] { typeof(FaultHandlersActivity), DR.GetString(DR.ViewExceptions) });

                if (loader == null ||
                    (designer.Activity is ICompensatableActivity && typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                    (!locked || FindActivity(designer, typeof(CompensationHandlerActivity)) != null)))
                    viewTypes.Add(new object[] { typeof(CompensationHandlerActivity), DR.GetString(DR.ViewCompensation) });

                if (loader == null ||
                    (Type.GetType(EventHandlingScopeRef).IsAssignableFrom(activityType) &&
                    (!locked || FindActivity(designer, Type.GetType(EventHandlersRef)) != null)))
                    viewTypes.Add(new object[] { Type.GetType(EventHandlersRef), DR.GetString(DR.ViewEvents) });
            }

            //Now go through the view types and create views
            List<DesignerView> views = new List<DesignerView>();
            for (int i = 0; i < viewTypes.Count; i++)
            {
                Type viewType = viewTypes[i][0] as Type;
                DesignerView view = new SecondaryView(designer, i + 1, viewTypes[i][1] as string, viewType);
                views.Add(view);
            }

            return views.AsReadOnly();
        }
        internal static ReadOnlyCollection <DesignerView> GetViews(StructuredCompositeActivityDesigner designer)
        {
            if (designer.Activity == null)
            {
                throw new ArgumentException("Component can not be null!");
            }
            bool            flag = !designer.IsEditable;
            List <object[]> list = new List <object[]>();
            string          toolboxDisplayName = ActivityToolboxItem.GetToolboxDisplayName(designer.Activity.GetType());

            list.Add(new object[] { designer.Activity.GetType(), DR.GetString("ViewActivity", new object[] { toolboxDisplayName }) });
            if (designer.Activity.Site != null)
            {
                WorkflowDesignerLoader service = designer.Activity.Site.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                Type c = designer.Activity.GetType();
                if ((service == null) || (typeof(CompositeActivity).IsAssignableFrom(c) && (!flag || (FindActivity(designer, typeof(CancellationHandlerActivity)) != null))))
                {
                    list.Add(new object[] { typeof(CancellationHandlerActivity), DR.GetString("ViewCancelHandler", new object[0]) });
                }
                if ((service == null) || (typeof(CompositeActivity).IsAssignableFrom(c) && (!flag || (FindActivity(designer, typeof(FaultHandlersActivity)) != null))))
                {
                    list.Add(new object[] { typeof(FaultHandlersActivity), DR.GetString("ViewExceptions", new object[0]) });
                }
                if ((service == null) || (((designer.Activity is ICompensatableActivity) && typeof(CompositeActivity).IsAssignableFrom(c)) && (!flag || (FindActivity(designer, typeof(CompensationHandlerActivity)) != null))))
                {
                    list.Add(new object[] { typeof(CompensationHandlerActivity), DR.GetString("ViewCompensation", new object[0]) });
                }
                if ((service == null) || (Type.GetType("System.Workflow.Activities.EventHandlingScopeActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35").IsAssignableFrom(c) && (!flag || (FindActivity(designer, Type.GetType("System.Workflow.Activities.EventHandlersActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")) != null))))
                {
                    list.Add(new object[] { Type.GetType("System.Workflow.Activities.EventHandlersActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"), DR.GetString("ViewEvents", new object[0]) });
                }
            }
            List <DesignerView> list2 = new List <DesignerView>();

            for (int i = 0; i < list.Count; i++)
            {
                Type         activityType = list[i][0] as Type;
                DesignerView item         = new SecondaryView(designer, i + 1, list[i][1] as string, activityType);
                list2.Add(item);
            }
            return(list2.AsReadOnly());
        }
        internal static ReadOnlyCollection <DesignerView> GetViews(StructuredCompositeActivityDesigner designer)
        {
            Debug.Assert(designer.Activity != null);
            if (designer.Activity == null)
            {
                throw new ArgumentException("Component can not be null!");
            }

            bool locked = !designer.IsEditable;

            //Get all the possible view types
            List <object[]> viewTypes = new List <object[]>();

            string displayName = ActivityToolboxItem.GetToolboxDisplayName(designer.Activity.GetType());

            viewTypes.Add(new object[] { designer.Activity.GetType(), DR.GetString(DR.ViewActivity, displayName) });

            //Only show the views in workflow designer or for nested activities
            if (designer.Activity.Site != null)
            {
                WorkflowDesignerLoader loader = designer.Activity.Site.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                Type activityType             = designer.Activity.GetType();

                if (loader == null ||
                    (typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                     (!locked || FindActivity(designer, typeof(CancellationHandlerActivity)) != null)))
                {
                    viewTypes.Add(new object[] { typeof(CancellationHandlerActivity), DR.GetString(DR.ViewCancelHandler) });
                }

                if (loader == null ||
                    (typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                     (!locked || FindActivity(designer, typeof(FaultHandlersActivity)) != null)))
                {
                    viewTypes.Add(new object[] { typeof(FaultHandlersActivity), DR.GetString(DR.ViewExceptions) });
                }

                if (loader == null ||
                    (designer.Activity is ICompensatableActivity && typeof(CompositeActivity).IsAssignableFrom(activityType) &&
                     (!locked || FindActivity(designer, typeof(CompensationHandlerActivity)) != null)))
                {
                    viewTypes.Add(new object[] { typeof(CompensationHandlerActivity), DR.GetString(DR.ViewCompensation) });
                }

                if (loader == null ||
                    (Type.GetType(EventHandlingScopeRef).IsAssignableFrom(activityType) &&
                     (!locked || FindActivity(designer, Type.GetType(EventHandlersRef)) != null)))
                {
                    viewTypes.Add(new object[] { Type.GetType(EventHandlersRef), DR.GetString(DR.ViewEvents) });
                }
            }

            //Now go through the view types and create views
            List <DesignerView> views = new List <DesignerView>();

            for (int i = 0; i < viewTypes.Count; i++)
            {
                Type         viewType = viewTypes[i][0] as Type;
                DesignerView view     = new SecondaryView(designer, i + 1, viewTypes[i][1] as string, viewType);
                views.Add(view);
            }

            return(views.AsReadOnly());
        }