bool CheckCanDeleteFlags(CanDeleteFlags flag) { // if DeleteItem or DeleteMultipleItems, we can assume that the delete // operation is supported. If it is not supported for a specific context, // then the CanDelete* method will be overriden, in which case this // CheckCanDeleteFlags won't be used. if (canDeleteFlags == CanDeleteFlags.NotChecked) { canDeleteFlags |= CanDeleteFlags.Checked; if (GetType().GetMethod("DeleteItem").DeclaringType != typeof(NodeCommandHandler)) { canDeleteFlags |= CanDeleteFlags.Single; } if (GetType().GetMethod("DeleteMultipleItems").DeclaringType != typeof(NodeCommandHandler) && GetType().GetMethod("CanDeleteItem").DeclaringType == typeof(NodeCommandHandler)) { canDeleteFlags |= CanDeleteFlags.Multiple; } } return((canDeleteFlags & flag) != 0); }
bool CheckCanDeleteFlags (CanDeleteFlags flag) { // if DeleteItem or DeleteMultipleItems, we can assume that the delete // operation is supported. If it is not supported for a specific context, // then the CanDelete* method will be overriden, in which case this // CheckCanDeleteFlags won't be used. if (canDeleteFlags == CanDeleteFlags.NotChecked) { canDeleteFlags |= CanDeleteFlags.Checked; if (GetType().GetMethod ("DeleteItem").DeclaringType != typeof(NodeCommandHandler)) canDeleteFlags |= CanDeleteFlags.Single; if (GetType().GetMethod ("DeleteMultipleItems").DeclaringType != typeof(NodeCommandHandler) && GetType().GetMethod ("CanDeleteItem").DeclaringType == typeof(NodeCommandHandler)) canDeleteFlags |= CanDeleteFlags.Multiple; } return (canDeleteFlags & flag) != 0; }