Пример #1
0
 /// <summary>
 /// set the currVerifyCtrl
 /// </summary>
 /// <param name="aCtrl"></param>
 public void setCurrVerifyCtrl(MgControlBase aCtrl)
 {
     if (aCtrl == null || aCtrl.getField() != null)
     {
         _currVerifyCtrl = aCtrl;
     }
 }
Пример #2
0
 /// <summary>
 ///   set the last parked control in this task
 /// </summary>
 /// <param name = "ctrl">last focused control</param>
 public virtual void setLastParkedCtrl(MgControlBase ctrl)
 {
     _lastParkedCtrl = ctrl;
     _currParkedFld  = (_lastParkedCtrl != null
                     ? _lastParkedCtrl.getField()
                     : null);
     CurrentEditingControl = ctrl;
 }
Пример #3
0
 /// <summary>
 /// Format
 /// </summary>
 /// <param name="control"></param>
 /// <param name="properties"></param>
 static void BuildTextPropertyFromFormat(MgControlBase control, Dictionary <string, DesignerPropertyInfo> properties)
 {
     if (control.getField() == null && !control.expressionSetAsData() || control.IsImageButton())
     {
         BuildTextProperty(control, properties, PropInterface.PROP_TYPE_FORMAT);
     }
     else
     {
         properties.Add(Constants.WinPropText, new DesignerPropertyInfo()
         {
             VisibleInPropertyGrid = true, Value = control.Value, IsDefaultValue = false
         });
     }
 }
Пример #4
0
        /// <summary>
        /// CalculatControlName
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="control"></param>
        /// <returns></returns>
        static String CalculatControlName(Dictionary <string, DesignerPropertyInfo> properties, MgControlBase control)
        {
            string name = String.Empty;

            //1. If the control has a Text property (see above) then the original studio text will be seen.
            if (properties.ContainsKey(Constants.WinPropText))
            {
                DesignerPropertyInfo TextPropertyInfo = properties[Constants.WinPropText];
                if (TextPropertyInfo != null)
                {
                    name = TextPropertyInfo.Value as String;
                }

                if (name != null)
                {
                    name = name.Trim();
                }
            }

            //2. If not or if the text is blank, then the control name will be seen.
            if (String.IsNullOrEmpty(name))
            {
                name = control.Name;

                //3. If the name is blank then the variable display(Display name property) name will be seen. (TODO take it from FieldDef)
                if (String.IsNullOrEmpty(name))
                {
                    Field fld = control.getField();
                    if (fld != null && !String.IsNullOrEmpty(fld.VarDisplayName))
                    {
                        name = fld.VarDisplayName;
                    }

                    if (name != null)
                    {
                        name = name.Trim();
                    }
                }

                ////4. If the display name is blank then the variable name will be seen.
                if (String.IsNullOrEmpty(name))
                {
                    Field fld = control.getField();
                    if (fld != null)
                    {
                        name = fld.getVarName();
                    }

                    if (name != null)
                    {
                        name = name.Trim();
                    }

                    // 5. If there is no variable name (such as for a Group control) then the word ‘Group’ will be seen.
                    if (String.IsNullOrEmpty(name))
                    {
                        name = control.Type.ToString();
                        //remove CTRL_TYPE_ from magic type
                        name = name.Remove(0, "CTRL_TYPE_".Length);
                        //move all string to lower
                        name = name.ToLower();
                        //move first char to upper
                        String FirstChar = char.ToUpper(name[0]).ToString();
                        name = name.Remove(0, 1);
                        name = name.Insert(0, FirstChar);
                        name = name.Trim();
                    }
                }
            }
            return(name);
        }