Ejemplo n.º 1
0
        private void BtnFile(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            case "_Multiple Nodes":
            {
                UiAddNodes ui = new UiAddNodes();
                ui.MainWindow = this;
                ui.Show();
                break;
            }

            case "_Export Topology":
            {
                UiExportTopology top = new UiExportTopology(myNetWork);
                top.Show();
                break;
            }

            case "_Import Topology":
            {
                UiImportTopology top = new UiImportTopology(this);
                top.Show();
                break;
            }
            }
        }
Ejemplo n.º 2
0
        private void BtnFile(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            case "_Multiple Nodes":
            {
                UiAddNodes ui = new UiAddNodes();
                ui.MainWindow = this;
                ui.Show();
                break;
            }

            case "_Add sink":
                if (isCoverageSelected)
                {
                    Sink sink = new Sink();
                    Canvas_SensingFeild.Children.Add(sink);
                }
                else
                {
                    MessageBox.Show("Select the Coverage!");
                }
                break;

            case "_Export Topology":
            {
                UiExportTopology top = new UiExportTopology(myNetWork);
                top.Show();
                break;
            }

            case "_Import Topology":
            {
                if (myNetWork.Count == 0)
                {
                    Settings.Default.Reset();         // back to the default values.
                    UiImportTopology top = new UiImportTopology(this);
                    top.Show();
                }
                else
                {
                    MessageBox.Show("The network is imported!");
                }
                break;
            }

            case "_Stop Simulation":
            {
                StopSimulation();
            }
            break;
            }
        }
Ejemplo n.º 3
0
        private void BtnFile(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            case "_Multiple Nodes":
            {
                if (myNetWork.Count == 0)
                {
                    UiAddNodes ui = new UiAddNodes();
                    ui.MainWindow = this;
                    ui.Show();
                }
                else
                {
                    MessageBox.Show("plz clear the network first");
                }
                break;
            }

            case "_Add sink":
                if (isCoverageSelected)
                {
                    Sink sink = new Sink();
                    Canvas_SensingFeild.Children.Add(sink);
                }
                else
                {
                    MessageBox.Show("Select the Coverage!");
                }
                break;

            case "_Export Topology":
            {
                UiExportTopology top = new UiExportTopology(myNetWork);
                top.Show();
                break;
            }

            case "_Import Topology":
            {
                UiImportTopology top = new UiImportTopology(this);
                top.Show();
                break;
            }
            }
        }
Ejemplo n.º 4
0
        private void ComponentMenuItem_Click(object sender, RoutedEventArgs e)
        {
            Point po = Mouse.GetPosition(canvas_vanet);

            MenuItem item       = sender as MenuItem;
            string   itemString = item.Header.ToString();

            switch (itemString)
            {
            case "_Network Generator":
            {
                OpenTopGen();
            }
            break;

            case "_Two Lanes":
            {
                RoadSegment rs = new RoadSegment(this, 2, RoadOrientation.Horizontal);
                rs.Height = rs.LanesCount * PublicParamerters.LaneWidth + 1.5;
                rs.Margin = new Thickness(po.X + 50, po.Y + 50, 0, 0);
                canvas_vanet.Children.Add(rs);
            }
            break;

            case "_Four Lanes":
            {
                RoadSegment rs = new RoadSegment(this, 4, RoadOrientation.Horizontal);
                rs.Height = rs.LanesCount * PublicParamerters.LaneWidth + 1.5;
                rs.Margin = new Thickness(po.X + 50, po.Y + 50, 0, 0);
                canvas_vanet.Children.Add(rs);
            }
            break;

            case "_Six Lanes":
            {
                RoadSegment rs = new RoadSegment(this, 6, RoadOrientation.Horizontal);
                rs.Height = rs.LanesCount * PublicParamerters.LaneWidth + 1.5;
                rs.Margin = new Thickness(po.X + 50, po.Y + 50, 0, 0);
                canvas_vanet.Children.Add(rs);
            }
            break;

            case "_Add Junction":
                Junction jun = new Junction(this);
                jun.Margin = new Thickness(po.X + 50, po.Y + 50, 0, 0);
                canvas_vanet.Children.Add(jun);
                break;

            case "_Import Vanet":
                UiImportTopology uim = new db.UiImportTopology(this);
                uim.Show();
                break;

            case "_Export Vanet":
                UiExportTopology win = new UiExportTopology(this);
                win.Show();
                break;

            case "_Clear":
            {
                Clear();
            }
            break;
            }
        }