Exemple #1
0
        internal DimensionCollection GetSelection()
        {
            var sel = new DimensionCollection();

            if (this.Nodes == null || Content == null)
            {
                return(null);
            }

            foreach (TreeNode dimNode in this.Nodes)
            {
                if (dimNode.Checked)
                {
                    var cleanDim = Content[(string)dimNode.Tag].Clone();
                    cleanDim.Hierarchies.Clear();

                    sel.Add(cleanDim);
                    foreach (TreeNode hierarchyNode in dimNode.Nodes)
                    {
                        if (hierarchyNode.Checked)
                        {
                            var cleanHierarchy = Content[(string)dimNode.Tag]
                                                 .Hierarchies[(string)hierarchyNode.Tag].Clone();
                            cleanHierarchy.Levels.Clear();

                            sel[(string)dimNode.Tag].Hierarchies.Add(cleanHierarchy);

                            foreach (TreeNode levelNode in hierarchyNode.Nodes)
                            {
                                if (levelNode.Checked)
                                {
                                    sel[(string)dimNode.Tag]
                                    .Hierarchies[(string)hierarchyNode.Tag].Levels.Add((string)levelNode.Tag,
                                                                                       sel[(string)dimNode.Tag]
                                                                                       .Hierarchies[(string)hierarchyNode.Tag]
                                                                                       .Levels[(string)levelNode.Tag]
                                                                                       .Clone());
                                }
                            }
                        }
                    }
                }
            }
            return(sel);
        }
Exemple #2
0
        public IArrayType UpdateDynamicType()
        {
            int       elementCount = this.readArraySize();
            ArrayType dataType     = (ArrayType)base.DataType;
            ReadOnlyDimensionCollection dimensions = dataType.Dimensions;
            DimensionCollection         dims       = new DimensionCollection();

            for (int i = 0; i < dimensions.Count; i++)
            {
                Dimension item = null;
                item = (i != 0) ? new Dimension(dimensions[i].LowerBound, dimensions[i].ElementCount) : new Dimension(dimensions[i].LowerBound, elementCount);
                dims.Add(item);
            }
            ArrayType type2 = new ArrayType(dataType.Name, (DataType)dataType.ElementType, dims, AdsDataTypeFlags.AnySizeArray | AdsDataTypeFlags.DataType);

            base.resolvedDataType = type2;
            return(type2);
        }
        internal DimensionCollection GetSelection()
        {
            var sel = new DimensionCollection();

            if (this.Nodes == null || Content==null)
                return null;

            foreach (TreeNode dimNode in this.Nodes)
            {
                if (dimNode.Checked)
                {
                    var cleanDim = Content[(string)dimNode.Tag].Clone();
                    cleanDim.Hierarchies.Clear();

                    sel.Add(cleanDim);
                    foreach (TreeNode hierarchyNode in dimNode.Nodes)
                    {
                        if (hierarchyNode.Checked)
                        {
                            var cleanHierarchy = Content[(string)dimNode.Tag]
                                .Hierarchies[(string)hierarchyNode.Tag].Clone();
                            cleanHierarchy.Levels.Clear();

                            sel[(string)dimNode.Tag].Hierarchies.Add(cleanHierarchy);

                            foreach (TreeNode levelNode in hierarchyNode.Nodes)
                            {
                                if (levelNode.Checked)
                                    sel[(string)dimNode.Tag]
                                        .Hierarchies[(string)hierarchyNode.Tag].Levels.Add((string)levelNode.Tag,
                                        sel[(string)dimNode.Tag]
                                        .Hierarchies[(string)hierarchyNode.Tag]
                                        .Levels[(string)levelNode.Tag]
                                        .Clone());
                            }
                        }
                    }
                }
            }
            return sel;
        }