Ejemplo n.º 1
0
        private void mnuSetBackground_Click(object sender, RoutedEventArgs e)
        {
            string filename = FileDialog.GetOpenFilename("Open background image...", "png", "Image File");

            if (filename != null)
            {
                try
                {
                    BitmapImage img = new BitmapImage(new Uri(filename));

                    RealizedNetworkImage ri = new RealizedNetworkImage();
                    ri.Bitmap               = img;
                    ri.FullFilename         = filename;
                    ri.SourceImage          = new WirelessNetworkImage();
                    ri.SourceImage.Scale    = 1.0 / 39;
                    ri.SourceImage.Filename = filename;


                    NetworkControl.Images.Clear();
                    NetworkControl.Images.Add(ri);

                    Network.Images.Clear();
                    Network.Images.Add(ri.SourceImage);

                    NetworkControl.Redraw();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception while trying to load image.\n" + ex.ToString());
                }
            }
        }
Ejemplo n.º 2
0
 void DeleteMouseDown(Point p)
 {
     if (SelectedNode != null)
     {
         Network.Nodes.Remove(SelectedNode);
         NetworkControl.Redraw();
     }
 }
Ejemplo n.º 3
0
        private void boxRange_TextChanged(object sender, TextChangedEventArgs e)
        {
            double newRange;

            if (Network != null && double.TryParse(boxRange.Text, out newRange))
            {
                Network.BaseTransmitRange = newRange;
                NetworkControl.Redraw();
            }
        }
Ejemplo n.º 4
0
        void AddMouseDown(Point p)
        {
            ActionContext c = GetActionContext();

            if (c?.AddNodeType != null)
            {
                // Verify that we are not adding too close to another node.
                if (SelectedNode != null)
                {
                    return;
                }

                Network.Nodes.Add(new WirelessNetworkNode()
                {
                    NodeType = c.AddNodeType.FullName,
                    X        = p.X,
                    Y        = p.Y
                });

                NetworkControl.Redraw();
            }
        }
Ejemplo n.º 5
0
 private void mnuRemoveBackground_Click(object sender, RoutedEventArgs e)
 {
     Network.Images.Clear();
     NetworkControl.Images.Clear();
     NetworkControl.Redraw();
 }
Ejemplo n.º 6
0
 private void Simulation_LedStateChanged()
 {
     // Need to update rendering for LEDs.
     NetworkControl.Redraw();
 }