Example #1
0
        /// <summary>
        /// Get list of controls which appropriate to multilanguage.
        /// </summary>
        /// <returns></returns>
        public Map <string, ScreenDetail> GetControlList()
        {
            if (MapControlCache == null)
            {
                m_mapControlCache = new Map <string, ScreenDetail>();
            }
            else
            {
                return(MapControlCache);
            }

            // Store own form.
            ScreenDetail screenDetail = new ScreenDetail();

            screenDetail.ObjOwner = this;
            screenDetail.Text     = ScreenAttribute.GetScreenAttribute(this.GetType()).ScreenDescription;
            screenDetail.Name     = this.Name;
            screenDetail.Type     = ScreenDetail.TYPE_FORM;
            m_mapControlCache.Put(this.Name, screenDetail);

            // Store recursive child controls.
            for (int i = 0; i < this.Controls.Count; i++)
            {
                RetrieveControls(MapControlCache, this.Controls[i]);
            }
            return(MapControlCache);
        }
Example #2
0
        /// <summary>
        /// Deep search in ControlCollection to retrieve available control.
        /// </summary>
        /// <param name="map">Map that use to store control</param>
        /// <param name="control">Parent control which will deep search.</param>
        private void RetrieveControls(Map <string, ScreenDetail> map, Control control)
        {
            // Store myself.
            if (!(control is UserControl))
            {
                ScreenDetail screenDetail = new ScreenDetail();

                if (control is IControlIdentify)
                {
                    screenDetail.Name = ((IControlIdentify)control).ControlID;
                    if (String.IsNullOrEmpty(screenDetail.Name))
                    {
                        screenDetail.Name = control.Name;
                    }
                }
                else
                {
                    screenDetail.Name = control.Name;
                }

                screenDetail.Text     = control.Text;
                screenDetail.ObjOwner = control;

                if (control is Label)
                {
                    screenDetail.Type = ScreenDetail.TYPE_LABEL;
                    map.Put(screenDetail.Name, screenDetail);
                    return;
                }

                if (control is CheckBox)
                {
                    screenDetail.Type = ScreenDetail.TYPE_CHECKBOX;
                    map.Put(screenDetail.Name, screenDetail);
                    return;
                }

                if (control is RadioButton)
                {
                    screenDetail.Type = ScreenDetail.TYPE_RADIOBUTTON;
                    map.Put(screenDetail.Name, screenDetail);
                    return;
                }

                if (control is Button)
                {
                    screenDetail.Type = ScreenDetail.TYPE_BUTTON;
                    map.Put(screenDetail.Name, screenDetail);
                    return;
                }


                if (control is GroupBox)
                {
                    screenDetail.Type = ScreenDetail.TYPE_GROUPBOX;
                    map.Put(screenDetail.Name, screenDetail);
                }
                else if (control is TabPage)
                {
                    screenDetail.Type = ScreenDetail.TYPE_TABPAGE;
                    map.Put(screenDetail.Name, screenDetail);
                }
                else if (control is FpSpread)
                {
                    FpSpread  spread    = (FpSpread)control;
                    SheetView sheetView = spread.Sheets[0];
                    for (int i = 0; i < sheetView.Columns.Count; i++)
                    {
                        Column column = sheetView.Columns[i];
                        if (column.Tag == null || column.Tag.ToString().Trim() == string.Empty)
                        {
                            continue;
                        }

                        screenDetail          = new ScreenDetail();
                        screenDetail.Name     = String.Format("{0}.{1}", spread.Name, column.Tag);
                        screenDetail.Text     = column.Label;
                        screenDetail.Type     = ScreenDetail.TYPE_SPREAD_COLUMN;
                        screenDetail.ObjOwner = column;
                        map.Put(screenDetail.Name, screenDetail);
                    }
                }
            }


            // Store child controls.
            for (int i = 0; i < control.Controls.Count; i++)
            {
                RetrieveControls(map, control.Controls[i]);
            } // end for
        }