Ejemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (selectedNodes.Count == 2)
            {
                NodeUI n1       = selectedNodes[0];
                NodeUI n2       = selectedNodes[1];
                int    distance = int.Parse(textBox2.Text);
                LinkUI link     = new LinkUI(n1, n2, distance);
                Canvas.SetZIndex(link, -1);

                if (!links.ContainsKey(n1))
                {
                    links.Add(n1, new List <LinkUI>());
                }

                if (!links.ContainsKey(n2))
                {
                    links.Add(n2, new List <LinkUI>());
                }

                n1.RoutingTable.addRoutingEntry(n2, distance, link);
                n2.RoutingTable.addRoutingEntry(n1, distance, link);
                n1.addLink(link);
                n2.addLink(link);

                links[n1].Add(link);
                links[n2].Add(link);
                canvas1.Children.Add(link);
            }
            else
            {
                listBox1.Items.Add("Two nodes need to be selected");
            }
        }
Ejemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (selectedNodes.Count == 2)
            {
                NodeUI n1 = selectedNodes[0];
                NodeUI n2 = selectedNodes[1];
                int distance = int.Parse(textBox2.Text);
                LinkUI link = new LinkUI(n1, n2, distance);
                Canvas.SetZIndex(link, -1);

                if (!links.ContainsKey(n1))
                    links.Add(n1, new List<LinkUI>());

                if (!links.ContainsKey(n2))
                    links.Add(n2, new List<LinkUI>());

                n1.RoutingTable.addRoutingEntry(n2, distance, link);
                n2.RoutingTable.addRoutingEntry(n1, distance, link);
                n1.addLink(link);
                n2.addLink(link);

                links[n1].Add(link);
                links[n2].Add(link);
                canvas1.Children.Add(link);
            }
            else
                listBox1.Items.Add("Two nodes need to be selected");
        }
Ejemplo n.º 3
0
 public void addRoutingEntry(NodeUI dest, int distance, LinkUI link)
 {
     routingTable.Add(dest, new RoutingTuple(dest, distance, link));
 }
Ejemplo n.º 4
0
 public RoutingTuple(NodeUI dest, int dist, LinkUI l)
 {
     Destination = dest;
     Distance    = dist;
     Link        = l;
 }
Ejemplo n.º 5
0
 public RoutingTuple(NodeUI dest, int dist, LinkUI l)
 {
     Destination = dest;
     Distance = dist;
     Link = l;
 }
Ejemplo n.º 6
0
 public void addRoutingEntry(NodeUI dest, int distance, LinkUI link)
 {
     routingTable.Add(dest, new RoutingTuple(dest, distance, link));
 }
Ejemplo n.º 7
0
 public void addLink(LinkUI l)
 {
     links.Add(l);
 }
Ejemplo n.º 8
0
 public void addLink(LinkUI l)
 {
     links.Add(l);
 }