Example #1
0
        /// <summary>
        /// Creates a new browser object with a set of filters.
        /// </summary>
        public AreaBrowser(
            ISystemContext context,
            ViewDescription view,
            NodeId referenceType,
            bool includeSubtypes,
            BrowseDirection browseDirection,
            QualifiedName browseName,
            IEnumerable <IReference> additionalReferences,
            bool internalOnly,
            AreaState area)
            :
            base(
                context,
                view,
                referenceType,
                includeSubtypes,
                browseDirection,
                browseName,
                additionalReferences,
                internalOnly)
        {
            m_stage = Stage.Begin;

            if (area != null)
            {
                m_area   = AreaState.GetDirectory(context, area.NodeId);
                m_isRoot = area.IsRoot;
            }
        }
Example #2
0
        /// <summary>
        /// Validates an area, creates the node and assigns node ids to all children.
        /// </summary>
        public bool ValidateArea(ISystemContext context, NodeState node)
        {
            // only need to validate once.
            node.OnValidate = null;

            DirectoryInfo directory = AreaState.GetDirectory(context, node.NodeId);

            if (directory == null || !directory.Exists)
            {
                return(false);
            }

            // initialize the area from the type model.
            node.Create(context, node.NodeId, node.BrowseName, null, false);

            // assign the child node ids.
            AssignChildNodeIds(context, node);

            return(true);
        }