Exemplo n.º 1
0
        private void btn_draw_random_numbers_MouseDown(object sender, MouseButtonEventArgs e)
        {
            List <KeyValuePair <int, double> > rands = new List <KeyValuePair <int, double> >();
            int index = 0;

            foreach (SensorRoutingLog log in Logs)
            {
                if (log.IsSend)
                {
                    index++;
                    rands.Add(new KeyValuePair <int, double>(index, log.ForwardingRandomNumber));
                }
            }
            UiRandomNumberGeneration wndsow = new ui.UiRandomNumberGeneration();

            wndsow.chart_x.DataContext = rands;
            wndsow.Show();
        }
        private void btn_other_Menu(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            //
            case "_Show Dead Node":
            {
                if (myNetWork.Count > 0)
                {
                    if (PublicParamerters.DeadNodeList.Count > 0)
                    {
                        UiNetworkLifetimeReport xx = new UiNetworkLifetimeReport();
                        xx.Title = "LoadBalanceProject Lifetime report";
                        xx.dg_grid.ItemsSource = PublicParamerters.DeadNodeList;
                        xx.Show();
                    }
                    else
                    {
                        MessageBox.Show("No Dead node.");
                    }
                }
                else
                {
                    MessageBox.Show("No Network is selected.");
                }
            }
            break;

            case "_Show Resultes":
            {
                if (myNetWork.Count > 0)
                {
                    ExpReport xx = new ExpReport(this);
                    xx.Show();
                }
            }
            break;

            case "_Draw Tree":

                break;

            case "_Print Info":
                UIshowSensorsLocations uIlocations = new UIshowSensorsLocations(myNetWork);
                uIlocations.Show();
                break;

            case "_Entir Network Routing Log":
                UiRoutingDetailsLong routingLogs = new ui.UiRoutingDetailsLong(myNetWork);
                routingLogs.Show();
                break;

            case "_Log For Each Sensor":

                break;

            //_Relatives:
            case "_Node Forwarding Probability Distributions":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Forwarding Probability Distributions For Each Node";
                foreach (Sensor source in myNetWork)
                {
                    if (source.MyForwardersShortedList.Count > 0)
                    {
                        ListControl List = new conts.ListControl();
                        List.lbl_title.Content   = "Node:" + source.ID;
                        List.dg_date.ItemsSource = source.MyForwardersShortedList;
                        windsow.stack_items.Children.Add(List);
                    }
                }
                windsow.Show();
                break;
            }

            //
            case "_Expermental Results":
                UIExpermentResults xxxiu = new UIExpermentResults();
                xxxiu.Show();
                break;

            case "_Probability Matrix":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Matrix";
                AdjecentMatrix   mat    = new AdjecentMatrix();
                List <DataTable> Tables = mat.ConvertToTable(myNetWork);
                foreach (DataTable table in Tables)
                {
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = table.TableName;
                    List.dg_date.ItemsSource = table.DefaultView;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
            }
            break;

            //
            case "_Packets Paths":
                UiRecievedPackertsBySink packsInsinkList = new UiRecievedPackertsBySink();
                packsInsinkList.Show();

                break;

            //
            case "_Random Numbers":

                List <KeyValuePair <int, double> > rands = new List <KeyValuePair <int, double> >();
                int index = 0;
                foreach (Sensor sen in myNetWork)
                {
                    foreach (SensorRoutingLog log in sen.Logs)
                    {
                        if (log.IsSend)
                        {
                            index++;
                            rands.Add(new KeyValuePair <int, double>(index, log.ForwardingRandomNumber));
                        }
                    }
                }

                UiRandomNumberGeneration wndsow = new ui.UiRandomNumberGeneration();
                wndsow.chart_x.DataContext = rands;
                wndsow.Show();

                break;

            case "_Nodes Load":
            {
                SegmaManager  sgManager = new SegmaManager();
                Sensor        sink      = PublicParamerters.SinkNode;
                List <string> Paths     = new List <string>();
                if (sink != null)
                {
                    foreach (Datapacket pck in sink.PacketsList)
                    {
                        Paths.Add(pck.Path);
                    }
                }

                sgManager.Filter(Paths);
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Nodes Load";
                SegmaCollection collectionx = sgManager.GetCollection;
                foreach (SegmaSource source in collectionx.GetSourcesList)
                {
                    source.NumberofPacketsGeneratedByMe = myNetWork[source.SourceID].NumberofPacketsGeneratedByMe;
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = "Source:" + source.SourceID + " Pks:" + source.NumberofPacketsGeneratedByMe + " Relays:" + source.RelaysCount + " Hops:" + source.HopsSum + " Mean:" + source.Mean + " Variance:" + source.Veriance + " E:" + source.PathsSpread;
                    List.dg_date.ItemsSource = source.GetRelayNodes;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
                break;
            }

            //_Distintc Paths
            case "_Distintc Paths":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Distinct Paths for each Source";
                DisPathConter dip = new DisPathConter();
                List <ClassfyPathsPerSource> classfy = dip.ClassyfyDistinctPathsPerSources();
                foreach (ClassfyPathsPerSource source in classfy)
                {
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = "Source:" + source.SourceID;
                    List.dg_date.ItemsSource = source.DistinctPathsForThisSource;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
                break;
            }
            }
        }
Exemplo n.º 3
0
        private void btn_other_Menu(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            //
            case "_Show Dead Node":
            {
                if (myNetWork.Count > 0)
                {
                    if (PublicParamerters.DeadNodeList.Count > 0)
                    {
                        UiNetworkLifetimeReport xx = new UiNetworkLifetimeReport();
                        xx.Title = "LORA Lifetime report";
                        xx.dg_grid.ItemsSource = PublicParamerters.DeadNodeList;
                        xx.Show();
                    }
                    else
                    {
                        MessageBox.Show("No Dead node.");
                    }
                }
                else
                {
                    MessageBox.Show("No Network is selected.");
                }
            }
            break;

            case "_Show Resultes":
            {
                ExpReport xx = new ExpReport(this);
                xx.Show();
            }
            break;

            case "_Print Info":
                UIshowSensorsLocations uIlocations = new UIshowSensorsLocations(myNetWork);
                uIlocations.Show();
                break;

            case "_Entir Network Routing Log":
                UiRoutingDetailsLong routingLogs = new ui.UiRoutingDetailsLong(myNetWork);
                routingLogs.Show();
                break;

            case "_Log For Each Sensor":

                break;

            //_Relatives:
            case "_Node Forwarding Probability Distributions":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Forwarding Probability Distributions For Each Node";
                foreach (Sensor source in myNetWork)
                {
                }
                windsow.Show();
                break;
            }

            //
            case "_Expermental Results":
                UIExpermentResults xxxiu = new UIExpermentResults();
                xxxiu.Show();
                break;

            case "_Probability Matrix":
            {
            }
            break;

            //
            case "_Packets Paths":
                UiRecievedPackertsBySink packsInsinkList = new UiRecievedPackertsBySink(PublicParamerters.FinishedRoutedPackets);
                packsInsinkList.Show();

                break;

            case "_Droped Packets Paths":
                UiRecievedPackertsBySink DropedPckWin = new UiRecievedPackertsBySink(PublicParamerters.DropedPacketsList);
                DropedPckWin.Show();
                break;

            case "_Random Numbers":

                List <KeyValuePair <int, double> > rands = new List <KeyValuePair <int, double> >();
                int index = 0;
                foreach (Sensor sen in myNetWork)
                {
                    foreach (RoutingLog log in sen.Logs)
                    {
                        if (log.IsSend)
                        {
                            index++;
                            rands.Add(new KeyValuePair <int, double>(index, log.ForwardingRandomNumber));
                        }
                    }
                }

                UiRandomNumberGeneration wndsow = new ui.UiRandomNumberGeneration();
                wndsow.chart_x.DataContext = rands;
                wndsow.Show();

                break;

            case "_Nodes Load":
            {
                /*
                 * SegmaManager sgManager = new SegmaManager();
                 * Sensor sink = PublicParamerters.SinkNode;
                 * List<string> Paths = new List<string>();
                 * if (sink != null)
                 * {
                 *  foreach (Packet pck in sink.PacketsList)
                 *  {
                 *      Paths.Add(pck.Path);
                 *  }
                 *
                 * }*/
                /*
                 * sgManager.Filter(Paths);
                 * UiShowLists windsow = new UiShowLists();
                 * windsow.Title = "Nodes Load";
                 * SegmaCollection collectionx = sgManager.GetCollection;
                 * foreach (SegmaSource source in collectionx.GetSourcesList)
                 * {
                 *  source.NumberofPacketsGeneratedByMe = myNetWork[source.SourceID].NumberofPacketsGeneratedByMe;
                 *  ListControl List = new conts.ListControl();
                 *  List.lbl_title.Content = "Source:" + source.SourceID + " Pks:" + source.NumberofPacketsGeneratedByMe + " Relays:" + source.RelaysCount + " Hops:" + source.HopsSum + " Mean:" + source.Mean + " Variance:" + source.Veriance + " E:" + source.PathsSpread;
                 *  List.dg_date.ItemsSource = source.GetRelayNodes;
                 *  windsow.stack_items.Children.Add(List);
                 * }
                 * windsow.Show();
                 */
            }
            break;
                //_Distintc Paths
            }
        }