Ejemplo n.º 1
0
        Object FindObjectToOpen(GridColumn column, int rowHandle)
        {
            Object result = null;

            if (column != null && GridListEditor != null && GridListEditor.GridView() != null)
            {
                Object    currObject = XtraGridUtils.GetRow(GridListEditor.GridView(), rowHandle);
                ITypeInfo typeInfo   = currObject != null
                                         ? XafTypesInfo.Instance.FindTypeInfo(currObject.GetType())
                                         : _listView.ObjectTypeInfo;

                IMemberInfo memberInfo = typeInfo.FindMember(column.FieldName);
                Object      lastObject = null;
                if (GridListEditor.GridView().ActiveEditor != null)
                {
                    lastObject = GridListEditor.GridView().ActiveEditor.EditValue;
                }
                else if (currObject != null && memberInfo != null)
                {
                    lastObject = FindLastObject(currObject, memberInfo);
                }
                if (memberInfo != null && (IsDetailViewExists(lastObject) &&
                                           DataManipulationRight.CanRead(typeInfo.Type, memberInfo.Name, currObject,
                                                                         LinkToListViewController.FindCollectionSource(
                                                                             Controller.Frame),
                                                                         ObjectSpace)))
                {
                    result = lastObject;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 public override void UpdateOpenObjectActionState(object objectToOpen)
 {
     base.UpdateOpenObjectActionState(objectToOpen);
     if (objectToOpen != null)
     {
         OpenObjectAction.Enabled[HasReadPermissionToTargetObjectEnabledKey] =
             DataManipulationRight.CanRead(objectToOpen.GetType(), null, objectToOpen,
                                           LinkToListViewController.FindCollectionSource(Controller.Frame),
                                           ObjectSpace);
     }
 }
        private void UpdateActionState( )
        {
            string diagnosticInfo;

            addFromFileAction.Enabled.SetItemValue("Security", DataManipulationRight.CanCreate(View, View.ObjectTypeInfo.Type, LinkToListViewController.FindCollectionSource(Frame), out diagnosticInfo));
            if (View != null && View.IsRoot)
            {
                addFromFileAction.Enabled.SetItemValue("ObjectSpaceNotModified", !ObjectSpace.IsModified);
            }
            else
            {
                addFromFileAction.Enabled.RemoveItem("ObjectSpaceNotModified");
            }
        }