コード例 #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;
            }
            }
        }
コード例 #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;
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: howbani/rr
        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;
            }
            }
        }