Пример #1
0
        private Element LoadElement(XPathNavigator node)
        {
            Element element = null;

            switch (node.Name)
            {
                case DataElement.ElementName:
                    _data = new DataElement(this, node);
                    if(_data.StartDate != null)
                        _startDate = _data.StartDate.Value;
                    element = _data;
                    break;
                case HeadElement.ElementName:
                    _head = new HeadElement(this, node);
                    element = _head;
                    break;
                case BodyElement.ElementName:
                    _body = new BodyElement(this, node);
                    element = _body;
                    break;
                case CalendarElement.ElementName:
                    _calendar = new CalendarElement(this, node);
                    element = _calendar;
                    break;
                case DayElement.ElementName:
                    element = new DayElement(this, node);
                    break;
                case AxisElement.ElementName:
                    AxisElement axis = new AxisElement(this, node);
                    axis.ViewStartDate = _startDate;
                    _axes.Add(axis);
                    element = axis;
                    break;
                case SpanElement.ElementName:
                    element = new SpanElement(this, node);
                    break;
                case IntervalElement.ElementName:
                    element = new IntervalElement(this, node);
                    break;
                case PointElement.ElementName:
                    element = new PointElement(this, node);
                    break;
                case RelationElement.ElementName:
                    RelationElement relation = new RelationElement(this, node);
                    relation.Origin = _map[relation.OriginId];
                    relation.Target = _map[relation.TargetId];
                    element = relation;
                    break;
                default:
                    element = new GanttElement(this, node);
                    break;
            }

            if (element != null)
            {
                AddElementToMap(element);

                if (node.HasChildren)
                {
                    foreach (XPathNavigator childNode in node.SelectChildren(XPathNodeType.Element))
                    {
                        Element childElement = LoadElement(childNode);
                        if (childElement != null)
                            element.AddChild(childElement);
                    }
                }
            }

            return element;
        }
Пример #2
0
        private Element LoadElement(XPathNavigator node)
        {
            Element element = null;

            switch (node.Name)
            {
            case DataElement.ElementName:
                _data = new DataElement(this, node);
                if (_data.StartDate != null)
                {
                    _startDate = _data.StartDate.Value;
                }
                element = _data;
                break;

            case HeadElement.ElementName:
                _head   = new HeadElement(this, node);
                element = _head;
                break;

            case BodyElement.ElementName:
                _body   = new BodyElement(this, node);
                element = _body;
                break;

            case CalendarElement.ElementName:
                _calendar = new CalendarElement(this, node);
                element   = _calendar;
                break;

            case DayElement.ElementName:
                element = new DayElement(this, node);
                break;

            case AxisElement.ElementName:
                AxisElement axis = new AxisElement(this, node);
                axis.ViewStartDate = _startDate;
                _axes.Add(axis);
                element = axis;
                break;

            case SpanElement.ElementName:
                element = new SpanElement(this, node);
                break;

            case IntervalElement.ElementName:
                element = new IntervalElement(this, node);
                break;

            case PointElement.ElementName:
                element = new PointElement(this, node);
                break;

            case RelationElement.ElementName:
                RelationElement relation = new RelationElement(this, node);
                relation.Origin = _map[relation.OriginId];
                relation.Target = _map[relation.TargetId];
                element         = relation;
                break;

            default:
                element = new GanttElement(this, node);
                break;
            }

            if (element != null)
            {
                AddElementToMap(element);

                if (node.HasChildren)
                {
                    foreach (XPathNavigator childNode in node.SelectChildren(XPathNodeType.Element))
                    {
                        Element childElement = LoadElement(childNode);
                        if (childElement != null)
                        {
                            element.AddChild(childElement);
                        }
                    }
                }
            }

            return(element);
        }
Пример #3
0
 // private
 private HeadElement CreateHeadElement()
 {
     HeadElement element = new HeadElement(this);
     _head = element;
     AddElement(element, _data);
     return element;
 }