示例#1
0
        private void SaveSectionZoneLayout()
        {
            SectionZoneLayout item = new SectionZoneLayout();

            item.Name = ItemName.Text;

            Configuration.GetInstance().SectionZoneLayouts.Add(item);
            SectionZoneLayout.Save(item);
        }
示例#2
0
        public List <object> GetItems(string folder, string name)
        {
            List <object> retVal = new List <object>();

            if (String.IsNullOrEmpty(name))
            {
                retVal = new List <object>(Configuration.GetInstance().SectionZoneLayouts.Cast <object>());
            }
            else
            {
                retVal.Add(SectionZoneLayout.GetByName(name));
            }

            return(retVal);
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            //the actual list of standard items to return
            StandardValuesCollection list   = null;
            SectionZoneLayout        layout = null;


            if (context.Instance is Section)
            {
                Section section = (Section)context.Instance;


                if (section.Parent != null)
                {
                    Screen screen = (Screen)section.Parent;
                    layout = SectionZoneLayout.GetByName(screen.SectionZoneLayout);
                }
            }

            if (layout == null)
            {
                if (!String.IsNullOrEmpty(Configuration.GetInstance().App.DefaultZoneLayout))
                {
                    layout = SectionZoneLayout.GetByName(Configuration.GetInstance().App.DefaultZoneLayout);
                }
            }

            if (layout != null)
            {
                var retVal = from item in layout.Dividers
                             where String.IsNullOrEmpty(item.Name) == false
                             select item.Name;

                var tempList = retVal.ToList <String>();
                tempList.Insert(0, String.Empty);

                string[] items = tempList.ToArray <string>();
                list = new StandardValuesCollection(items);
            }



            return(list);
        }
示例#4
0
 private static SectionZoneLayout GetZoneLayout(string screenLayout, SectionZoneLayout layout)
 {
     if (String.IsNullOrEmpty(screenLayout))
     {
         if (String.IsNullOrEmpty(CodeTorch.Core.Configuration.GetInstance().App.DefaultZoneLayout))
         {
             throw new ApplicationException("No default section zone layout to use");
         }
         else
         {
             layout = SectionZoneLayout.GetByName(CodeTorch.Core.Configuration.GetInstance().App.DefaultZoneLayout);
         }
     }
     else
     {
         layout = SectionZoneLayout.GetByName(screenLayout);
     }
     return(layout);
 }
示例#5
0
        public void RenderPageSections(PlaceHolder holder, string screenLayout, Screen screen, List <Section> sections, bool isNewRecord, SectionMode Mode, string ResourceKeyPrefix)
        {
            SectionZoneLayout layout = null;



            layout = GetZoneLayout(screenLayout, layout);


            if (isNewRecord)
            {
                holder.Controls.Clear();
            }


            List <SectionDivider> dividers = layout.Dividers;

            GenerateSectionDivs(holder, null, sections, Mode, ResourceKeyPrefix, dividers);
        }
示例#6
0
 public void Save(object configurationItem)
 {
     SectionZoneLayout.Save((SectionZoneLayout)configurationItem);
 }
示例#7
0
 public int GetCounts(string folder, string name)
 {
     return(SectionZoneLayout.GetItemCount(name));
 }
示例#8
0
 public void Load(XDocument doc, string folder)
 {
     SectionZoneLayout.Load(doc);
 }
示例#9
0
        private static TableLayoutPanel SetupSectionZoneLayout(EditScreen Me)
        {
            TableLayoutPanel zoneContainer = new TableLayoutPanel();

            SectionZoneLayout layout = null;
            int RowCount             = 1;
            int ColumnCount          = 1;

            int ActiveRowCount    = 1;
            int ActiveColumnCount = 1;

            int InactiveColumnCount = 0;
            int InactiveRowCount    = 0;

            if (!String.IsNullOrEmpty(Me.SectionZoneLayout))
            {
                layout = SectionZoneLayout.GetByName(Me.SectionZoneLayout);
            }
            else
            {
                string defaultZoneLayout = Eminent.AppBuilder.Core.Configuration.GetInstance().App.DefaultZoneLayout;
                if (!String.IsNullOrEmpty(defaultZoneLayout))
                {
                    layout = SectionZoneLayout.GetByName(defaultZoneLayout);
                }
            }

            if (layout != null)
            {
                //add zone container

                //todo - need to remove it from here
                //zoneContainer.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
                zoneContainer.ColumnCount = layout.ColumnCount;
                //zoneContainer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));

                if (!String.IsNullOrEmpty(layout.DesignerColumnWidths))
                {
                    string[] colWidths = layout.DesignerColumnWidths.Split(',');
                    for (int i = 0; i < colWidths.Length; i++)
                    {
                        if (!String.IsNullOrEmpty(colWidths[i]))
                        {
                            if (colWidths[i].Trim().EndsWith("%"))
                            {
                                float width = (float)Convert.ToDouble(colWidths[i].Replace("%", ""));
                                zoneContainer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, width));
                            }
                            else
                            {
                                float width = (float)Convert.ToDouble(colWidths[i].Replace("%", ""));
                                zoneContainer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, width));
                            }
                        }
                        else
                        {
                            zoneContainer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
                        }
                    }
                }


                zoneContainer.RowCount = layout.RowCount;
                if (!String.IsNullOrEmpty(layout.DesignerRowWidths))
                {
                    string[] rowWidths = layout.DesignerRowWidths.Split(',');
                    for (int i = 0; i < rowWidths.Length; i++)
                    {
                        if (!String.IsNullOrEmpty(rowWidths[i]))
                        {
                            if (rowWidths[i].Trim().EndsWith("%"))
                            {
                                float width = (float)Convert.ToDouble(rowWidths[i].Replace("%", ""));
                                zoneContainer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, width));
                            }
                            else
                            {
                                float width = (float)Convert.ToDouble(rowWidths[i].Replace("%", ""));
                                zoneContainer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, width));
                            }
                        }
                        else
                        {
                            zoneContainer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
                        }
                    }
                }
            }


            zoneContainer.Dock = DockStyle.Fill;

            foreach (SectionDivider z in layout.Zones)
            {
                SectionZoneDesigner zone = new SectionZoneDesigner();
                zone.Dock   = DockStyle.Fill;
                zone.Screen = Me;
                zone.Zone   = z;
                zone.InitControl();
                //zone.s
                zoneContainer.Controls.Add(zone, z.ColumnIndex, z.RowIndex);
                zoneContainer.SetColumnSpan(zone, z.ColumnSpan);
                zoneContainer.SetRowSpan(zone, z.RowSpan);
            }
            return(zoneContainer);
        }