예제 #1
0
        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];
                        }
                    }
                }
            }
        }
예제 #2
0
        private IList CreateIPointInfos(Type taskType, InteractionPointInfoCollection iPointInfos)
        {
            FieldInfo[] fields            = taskType.GetFields(BindingFlags.Public | BindingFlags.Static);
            ArrayList   iPointInfWrappers = new ArrayList();

            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);
        }
        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;
            }
        }
예제 #4
0
 public InteractionPointInfoWrapper(InteractionPointInfo iPointInf,
                                    InteractionPointAttribute ipInfAttribute, NavTargetAttribute[] navTargAttributes)
 {
     this.iPointInf         = iPointInf;
     this.ipInfAttribute    = ipInfAttribute;
     this.navTargAttributes = navTargAttributes;
 }
예제 #5
0
 protected virtual InteractionPointInfo CreateInteractionPointInfo(string viewName,
                                     InteractionPointAttribute ipAttribute)
 {
     InteractionPointInfo result = new InteractionPointInfo();
     result.ViewName = viewName;
     result.ControllerType = ipAttribute.ControllerType;
     result.IsCommonTarget = ipAttribute.IsCommonTarget;
     return result;
 }
예제 #6
0
        private InteractionPointInfo CreateInteractionPointInfo(string viewName,
                                                                InteractionPointAttribute ipAttribute)
        {
            InteractionPointInfo result = new InteractionPointInfo();

            result.ViewName       = viewName;
            result.ControllerType = ipAttribute.ControllerType;
            result.IsCommonTarget = ipAttribute.IsCommonTarget;
            return(result);
        }
        private InteractionPointInfo CreateInteractionPointInfo(XmlElement interactionPointElement,
                                                                Assembly controllersDefaultAssembly)
        {
            InteractionPointInfo result = new InteractionPointInfo();
            result.ViewName = interactionPointElement.GetAttribute("view");
            result.IsCommonTarget = interactionPointElement.GetAttribute("isCommonTarget") == "true";
            string controllerTypeName = interactionPointElement.GetAttribute("controllerType");
            if (controllerTypeName.IndexOf(',') < 0)
                controllerTypeName = controllerTypeName + ", " + controllersDefaultAssembly.FullName;
            result.ControllerType = Type.GetType(controllerTypeName);

            return result;
        }
        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);
        }
        private InteractionPointInfo CreateInteractionPointInfo(XmlElement interactionPointElement,
                                                                Assembly controllersDefaultAssembly)
        {
            InteractionPointInfo result = new InteractionPointInfo();

            result.ViewName       = interactionPointElement.GetAttribute("view");
            result.IsCommonTarget = interactionPointElement.GetAttribute("isCommonTarget") == "true";
            string controllerTypeName = interactionPointElement.GetAttribute("controllerType");

            if (controllerTypeName.IndexOf(',') < 0)
            {
                controllerTypeName = controllerTypeName + ", " + controllersDefaultAssembly.FullName;
            }
            result.ControllerType = Type.GetType(controllerTypeName);

            return(result);
        }
예제 #10
0
        /// <summary>
        /// Looks through the <see cref="TaskInfo.InteractionPoints"/> collection
        /// to determine whether the navigation to the destination view
        /// is possible.
        /// </summary>
        /// <param name="currViewName">The name of the current view.</param>
        /// <param name="destViewName">The name of the destination view.</param>
        /// <returns><c>True</c> if the navigation is possible, otherwise
        /// <c>false</c>.</returns>
        #endregion
        public bool CanNavigateToView(string currViewName, string destViewName)
        {
            if ((InteractionPoints[destViewName] != null) &&
                InteractionPoints[destViewName].IsCommonTarget)
            {
                return(true);
            }
            InteractionPointInfo currPoint = InteractionPoints[currViewName];

            foreach (InteractionPointInfo targetPoint in currPoint.NavTargets)
            {
                if (targetPoint.ViewName == destViewName)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #11
0
        /// <summary>
        /// Looks through the <see cref="TaskInfo.InteractionPoints"/> collection
        /// to retrieve the name of the next view, given the current view
        /// name and the navigation trigger name.
        /// </summary>
        /// <param name="currViewName">The name of the current view.</param>
        /// <param name="triggerName">The name of the navigation trigger (may be
        /// equal to the target view name).</param>
        /// <returns>The name of the next view or <c>null</c> if
        /// not found.</returns>
        #endregion
        public string GetNextViewName(string currViewName, string triggerName)
        {
            InteractionPointInfo currPoint = InteractionPoints[currViewName];
            InteractionPointInfo target    = currPoint.NavTargets[triggerName];

            if (target == null)
            {
                InteractionPointInfo possibleCommonTarget = iPoints[triggerName];
                if ((possibleCommonTarget != null) && possibleCommonTarget.IsCommonTarget)
                {
                    target = possibleCommonTarget;
                }
            }

            if (target == null)
            {
                return(null);
            }
            return(target.ViewName);
        }
 public InteractionPointInfoWrapper(InteractionPointInfo iPointInf, XmlElement iPointElmt)
 {
     this.iPointElmt = iPointElmt;
     this.iPointInf = iPointInf;
 }
예제 #13
0
 public InteractionPointInfoWrapper(InteractionPointInfo iPointInf,
        InteractionPointAttribute ipInfAttribute, NavTargetAttribute[] navTargAttributes)
 {
     this.iPointInf = iPointInf;
     this.ipInfAttribute = ipInfAttribute;
     this.navTargAttributes = navTargAttributes;
 }
 public InteractionPointInfoWrapper(InteractionPointInfo iPointInf, XmlElement iPointElmt)
 {
     this.iPointElmt = iPointElmt;
     this.iPointInf  = iPointInf;
 }