Пример #1
0
        private void ReloadCurrentCollection()
        {
            TabControl.SelectedIndexChanged -= TabChangedHandler;
            ClearTabPages();

            if (_businessObjectCollection == null)
            {
                TabControl.SelectedIndexChanged += TabChangedHandler;
                return;
            }
            foreach (BusinessObject bo in _businessObjectCollection.Clone())
            {
                AddTabPage(bo);
            }
            if (_businessObjectCollection.Count > 0 && AutoSelectFirstItem)
            {
                TabControl.SelectedIndex = 0;
            }
            else
            {
                TabControl.SelectedIndex = -1;
            }
            TabControl.SelectedIndexChanged += TabChangedHandler;

            _businessObjectCollection.BusinessObjectAdded   += BusinessObjectAddedHandler;
            _businessObjectCollection.BusinessObjectRemoved += BusinessObjectRemovedHandler;
            TabChanged();
        }
Пример #2
0
 private void LoadRelationshipNode(IRelationship relationship, ITreeNodeCollection nodes)
 {
     if (relationship is IMultipleRelationship)
     {
         IMultipleRelationship     multipleRelationship = (IMultipleRelationship)relationship;
         IBusinessObjectCollection children             = multipleRelationship.BusinessObjectCollection;
         foreach (IBusinessObject businessObject in children.Clone())
         {
             AddBusinessObjectNode(nodes, businessObject);
         }
     }
     else
     {
         ISingleRelationship singleRelationship = (ISingleRelationship)relationship;
         IBusinessObject     businessObject     = singleRelationship.GetRelatedObject();
         if (businessObject != null)
         {
             AddBusinessObjectNode(nodes, businessObject);
         }
     }
 }
Пример #3
0
 private void RemoveRelationshipNode(IRelationship relationship)
 {
     this.RelationshipNodes.Remove(relationship);
     if (relationship is IMultipleRelationship)
     {
         IMultipleRelationship     multipleRelationship = (IMultipleRelationship)relationship;
         IBusinessObjectCollection children             = multipleRelationship.BusinessObjectCollection;
         ChildCollectionNodes.Remove(children);
         foreach (IBusinessObject businessObject in children.Clone())
         {
             RemoveBusinessObjectNode(businessObject);
         }
     }
     else
     {
         ISingleRelationship singleRelationship = (ISingleRelationship)relationship;
         IBusinessObject     businessObject     = singleRelationship.GetRelatedObject();
         if (businessObject != null)
         {
             RemoveBusinessObjectNode(businessObject);
         }
     }
 }