Пример #1
0
        private void ButtonProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            var propertyValue = EditValue;

            var objectType = propertyValue.GetType();
            BaseObjectEditControl editControl = null;

            // 如果不是PaoObject类型,则显示默认编辑控件
            if (!objectType.IsAddonType())
            {
                editControl = EditorPublic.CreateEditControl(objectType) as BaseObjectEditControl;
            }

            if (editControl == null)
            {
                var editController = EditorPublic.GetOrCreateEditControllerFromStorage <ObjectLayoutEditController>(objectType);
                editControl = editController.CreateEditControl(objectType) as BaseObjectEditControl;
            }

            editControl.EditValue = IOPublic.ObjectClone(propertyValue);
            UIPublic.CloseWaitingForm();
            if (WinFormPublic.ShowDialog(editControl) == DialogReturn.OK)
            {
                EditValue = editControl.EditValue;
            }
            SetControlStatus();
        }
Пример #2
0
 /// <summary>
 /// 获取预定义的编辑控制器
 /// </summary>
 /// <param name="objectType">对象类型</param>
 /// <param name="propertyName">属性名称</param>
 /// <returns>编辑控制器</returns>
 public BaseEditController GetPredefinedEditController(Type objectType, string propertyName)
 {
     if (PredefinedEditorTypes.IsNotNullOrEmpty() &&
         PredefinedEditorTypes.ContainsKey(propertyName) &&
         PredefinedEditorTypes[propertyName] != null)
     {
         return(EditorPublic.GetOrCreateEditControllerFromStorage(objectType, PredefinedEditorTypes[propertyName]));
     }
     return(null);
 }