Beispiel #1
0
 private void RemoveNode(AddressesNode node)
 {
     if (this.IsExists(node))
     {
         LocalAddress parent = ((LocalAddress) node.get_Tag()).GetParent();
         if (parent == LocalAddress.Null)
         {
             base.Nodes.Remove(node);
         }
         else
         {
             AddressesNode nodeByAddress = this.GetNodeByAddress(parent);
             if (nodeByAddress == null)
             {
                 base.Nodes.Remove(node);
             }
             else
             {
                 base.Nodes.Remove(node);
                 if (nodeByAddress.Nodes.get_Count() == 0)
                 {
                     this.RemoveNode(nodeByAddress);
                 }
             }
         }
     }
 }
Beispiel #2
0
 private void AddNode(AddressesNode node)
 {
     if (!this.IsExists(node))
     {
         LocalAddress parent = (LocalAddress) ((LocalAddress) node.get_Tag()).Parent;
         if ((parent == null) || (parent == LocalAddress.Null))
         {
             parent = ((LocalAddress) node.get_Tag()).GetParent();
         }
         if (parent == LocalAddress.Null)
         {
             base.Nodes.Add(node);
             node.NullAdd();
         }
         else
         {
             AddressesNode nodeByAddress = this.GetNodeByAddress(parent);
             if (nodeByAddress != null)
             {
                 nodeByAddress.Nodes.Add(node);
                 node.NullAdd();
             }
             else
             {
                 AddressesNode node3 = new AddressesNode(parent);
                 this.AddNode(node3);
                 node3.Nodes.Add(node);
                 node.NullAdd();
             }
         }
     }
 }
Beispiel #3
0
 private void OnPaint(AddressesNode addressesNode)
 {
     if ((this.TreeSource != null) && (addressesNode != null))
     {
         LocalAddress address = (LocalAddress) addressesNode.get_Tag();
         if (address.Level == AddressLevel.Жилье)
         {
             addressesNode.set_ForeColor(DefaultColor);
         }
         else if (!this.IsExists(this.TreeSource, addressesNode))
         {
             addressesNode.SetColor();
         }
         else
         {
             addressesNode.set_ForeColor(DefaultColor);
             addressesNode.Expand();
             foreach (System.Windows.Forms.TreeNode node in addressesNode.Nodes)
             {
                 this.OnPaint((AddressesNode) node);
             }
         }
     }
 }
Beispiel #4
0
 public void GetLeavesByRoot(ObjectList<LocalAddress> addresses, AddressesNode node)
 {
     node.NullDelete();
     if ((node.Nodes.get_Count() == 0) || (node.ForeColor == Color))
     {
         if (addresses.FindById(((LocalAddress) node.get_Tag()).Id) == null)
         {
             addresses.Add((LocalAddress) node.get_Tag());
         }
         node.NullAdd();
     }
     else
     {
         foreach (AddressesNode node2 in node.Nodes)
         {
             this.GetLeavesByRoot(addresses, node2);
         }
     }
 }