예제 #1
0
        private void DispatchComponents()
        {
            this.columns    = new List <SlabColumn>();
            this.topRows    = new List <SlabRow>();
            this.bottomRows = new List <SlabRow>();
            int num = 0;

            foreach (SlabComponent slabComponent in this.Components)
            {
                SlabColumn slabColumn = slabComponent as SlabColumn;
                if (slabColumn != null)
                {
                    if (num == 0)
                    {
                        num = 1;
                    }
                    else if (num == 2)
                    {
                        throw new InvalidOperationException("Don't add SlabRow between SlabColumns! SlabRow can only be added before or after SlabClolumns.");
                    }
                    this.columns.Add(slabColumn);
                }
                else if (num == 0)
                {
                    this.topRows.Add((SlabRow)slabComponent);
                }
                else
                {
                    num = 2;
                    this.bottomRows.Add((SlabRow)slabComponent);
                }
            }
        }
예제 #2
0
        private void Refactor()
        {
            double num  = 0.0;
            double num2 = 0.0;
            bool   flag = false;

            foreach (SlabRow slabRow in this.topRows)
            {
                slabRow.Refactor();
            }
            foreach (SlabRow slabRow2 in this.bottomRows)
            {
                slabRow2.Refactor();
            }
            for (int i = this.columns.Count - 1; i >= 0; i--)
            {
                SlabColumn slabColumn = this.columns[i];
                slabColumn.Refactor();
                bool flag2 = false;
                if (slabColumn.Slabs.Count == 0)
                {
                    this.columns.RemoveAt(i);
                    flag2 = true;
                }
                if (slabColumn.Width.Type == UnitType.Percentage)
                {
                    num += slabColumn.Width.Value;
                    if (flag2)
                    {
                        flag = true;
                    }
                    else
                    {
                        num2 += slabColumn.Width.Value;
                    }
                }
            }
            if (flag && num2 != 0.0)
            {
                double num3 = num / num2;
                foreach (SlabColumn slabColumn2 in this.columns)
                {
                    if (slabColumn2.Width.Type == UnitType.Percentage)
                    {
                        slabColumn2.Width = new Unit(slabColumn2.Width.Value * num3, UnitType.Percentage);
                    }
                }
            }
        }
예제 #3
0
 private void BuildControl(Control ctrl)
 {
     if (this.slab != null)
     {
         this.slab.InitializeAsUserControl(this);
         if (this.slab.LayoutOnly)
         {
             throw new NotSupportedException("LayoutOnly slab control cannot be initialized as an independent slab.");
         }
         base.Title = this.slab.Title;
         SlabTable slabTable = new SlabTable();
         slabTable.HelpId           = this.slab.HelpId;
         slabTable.IsSingleSlabPage = true;
         SlabColumn slabColumn = new SlabColumn();
         slabColumn.Slabs.Add(this.slab);
         slabTable.Components.Add(slabColumn);
         base.FeatureSet = this.slab.FeatureSet;
         ctrl.Controls.Add(slabTable);
     }
 }