private void FillNavTargets(Type taskType, IList iPointInfWrappers,
                                    InteractionPointInfoCollection ipInfos)
        {
            AdjacentPointsAttribute[] adjPointAttributes = taskType.GetCustomAttributes(
                typeof(AdjacentPointsAttribute), false) as AdjacentPointsAttribute[];
            foreach (InteractionPointInfoWrapper ipWrapper in iPointInfWrappers)
            {
                InteractionPointInfo iPointInf = ipWrapper.iPointInf;

                foreach (string targetName in ipWrapper.ipInfAttribute.NavTargets)
                {
                    iPointInf.NavTargets[targetName] = ipInfos[targetName];
                }
                foreach (NavTargetAttribute trgAttr in ipWrapper.navTargAttributes)
                {
                    iPointInf.NavTargets[trgAttr.TriggerName] = ipInfos[trgAttr.ViewName];
                }
                foreach (AdjacentPointsAttribute containingAdjPointAttr in
                         GetContainingAdjPointAttrs(iPointInf.ViewName, adjPointAttributes))
                {
                    foreach (string adjPointName in containingAdjPointAttr.AdjacentViewNames)
                    {
                        if (adjPointName != iPointInf.ViewName)
                        {
                            iPointInf.NavTargets[adjPointName] = ipInfos[adjPointName];
                        }
                    }
                }
            }
        }
        private IList CreateIPointInfos(Type taskType, InteractionPointInfoCollection iPointInfos)
        {
            FieldInfo[] fields = taskType.GetFields(BindingFlags.Public | BindingFlags.Static);
            List <InteractionPointInfoWrapper> iPointInfWrappers = new List <InteractionPointInfoWrapper>();

            foreach (FieldInfo field in fields)
            {
                if (field.IsLiteral && field.FieldType == typeof(string))
                {
                    InteractionPointAttribute[] ipAttributes = field.GetCustomAttributes(
                        typeof(InteractionPointAttribute), false) as InteractionPointAttribute[];
                    if (ipAttributes.Length > 0)
                    {
                        string viewName = field.GetValue(null) as string;
                        NavTargetAttribute[] navTargAttributes = field.GetCustomAttributes(
                            typeof(NavTargetAttribute), false) as NavTargetAttribute[];
                        InteractionPointInfo iPointInf = CreateInteractionPointInfo(
                            viewName, ipAttributes[0]);
                        iPointInfos[viewName] = iPointInf;
                        iPointInfWrappers.Add(new InteractionPointInfoWrapper(iPointInf,
                                                                              ipAttributes[0], navTargAttributes));
                    }
                }
            }
            return(iPointInfWrappers);
        }
Esempio n. 3
0
        private void FillNavTargets(InteractionPointInfoWrapper iPointInfWrapper,
                                    InteractionPointInfoCollection iPointInfos)
        {
            foreach (XmlElement navTargetElmt in iPointInfWrapper.iPointElmt.SelectNodes("navTarget"))
            {
                string triggerName          = navTargetElmt.GetAttribute("trigger");
                InteractionPointInfo target = iPointInfos[navTargetElmt.GetAttribute("view")];
                if (triggerName == string.Empty)
                {
                    triggerName = target.ViewName;
                }
                iPointInfWrapper.iPointInf.NavTargets[triggerName] = target;
            }
            string      quotedViewName     = "\"" + iPointInfWrapper.iPointInf.ViewName + "\"";
            XmlNodeList adjacentPointElmts = iPointInfWrapper.iPointElmt.SelectNodes(
                "/*/adjacentPoints[iPointRef/@view | interactionPointRef/@view = "
                + quotedViewName + "]/*[self::iPointRef or self::interactionPointRef][@view!="
                + quotedViewName + "]");

            foreach (XmlElement adjacentPointElmt in adjacentPointElmts)
            {
                string targetViewName = adjacentPointElmt.GetAttribute("view");
                if ((iPointInfWrapper.iPointInf.NavTargets[targetViewName] != null) &&
                    (iPointInfWrapper.iPointInf.NavTargets[targetViewName].ViewName == targetViewName))
                {
                    continue;
                }
                InteractionPointInfo target = iPointInfos[targetViewName];
                string triggerName          = target.ViewName;
                iPointInfWrapper.iPointInf.NavTargets[targetViewName] = target;
            }
        }
Esempio n. 4
0
        private InteractionPointInfoWrapper[] CreateInteractionPointInfos(Type taskType,
                                                                          InteractionPointInfoCollection iPointInfos)
        {
            Assembly    controllersDefaultAssembly = taskType.Assembly;
            XmlNodeList iPntNodes = GetTaskRootElement(taskType).SelectNodes(
                "interactionPoints/*[self::iPoint or self::interactionPoint]");

            InteractionPointInfoWrapper[] iPointWrappers = new InteractionPointInfoWrapper[iPntNodes.Count];
            for (int i = 0; i < iPntNodes.Count; i++)
            {
                InteractionPointInfo ipInfo = CreateInteractionPointInfo(iPntNodes[i] as XmlElement, controllersDefaultAssembly);
                iPointInfos[ipInfo.ViewName] = ipInfo;
                iPointWrappers[i]            = new InteractionPointInfoWrapper(ipInfo, iPntNodes[i] as XmlElement);
            }
            return(iPointWrappers);
        }