private void Prog_batteryCapacityNotation_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { double val = ResidualEnergyPercentage; if (val <= 0) { // dead certificate: Lifetime.DeadNodesRecord recod = new Lifetime.DeadNodesRecord(); recod.DeadAfterPackets = PublicParamerters.PackeTSequenceID; recod.DeadOrder = PublicParamerters.DeadNodeList.Count + 1; recod.Rounds = PublicParamerters.Rounds + 1; recod.DeadNodeID = ID; recod.NOS = PublicParamerters.NOS; recod.NOP = PublicParamerters.NOP; PublicParamerters.DeadNodeList.Add(recod); Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col0)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col0)); // if (Settings.Default.StopeWhenFirstNodeDeid) { MainWindow.TimerCounter.Stop(); MainWindow.RandomSelectSourceNodesTimer.Stop(); MainWindow.stopSimlationWhen = PublicParamerters.SimulationTime; MainWindow.top_menu.IsEnabled = true; } } if (val >= 1 && val <= 9) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col1_9)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col1_9)); } if (val >= 10 && val <= 19) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col10_19)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col10_19)); } if (val >= 20 && val <= 29) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col20_29)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col20_29)); } // full: if (val >= 30 && val <= 39) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col30_39)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col30_39)); } // full: if (val >= 40 && val <= 49) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col40_49)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col40_49)); } // full: if (val >= 50 && val <= 59) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col50_59)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col50_59)); } // full: if (val >= 60 && val <= 69) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col60_69)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col60_69)); } // full: if (val >= 70 && val <= 79) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col70_79)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col70_79)); } // full: if (val >= 80 && val <= 89) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col80_89)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col80_89)); } // full: if (val >= 90 && val <= 100) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col90_100)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col90_100)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Prog_batteryCapacityNotation_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { double val = ResidualEnergyPercentage; if (val <= 0) { // dead certificate: Lifetime.DeadNodesRecord recod = new Lifetime.DeadNodesRecord(); recod.DeadAfterPackets = PublicParamerters.PackeTSequenceID; recod.DeadOrder = PublicParamerters.DeadNodeList.Count + 1; recod.Rounds = PublicParamerters.Rounds + 1; recod.DeadNodeID = ID; recod.NOS = PublicParamerters.NOS; recod.NOP = PublicParamerters.NOP; recod.RoutingZone = Settings.Default.ZoneWidthCnt; PublicParamerters.DeadNodeList.Add(recod); Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col0)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col0)); } if (val >= 1 && val <= 9) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col1_9)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col1_9)); } if (val >= 10 && val <= 19) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col10_19)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col10_19)); } if (val >= 20 && val <= 29) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col20_29)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col20_29)); } // full: if (val >= 30 && val <= 39) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col30_39)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col30_39)); } // full: if (val >= 40 && val <= 49) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col40_49)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col40_49)); } // full: if (val >= 50 && val <= 59) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col50_59)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col50_59)); } // full: if (val >= 60 && val <= 69) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col60_69)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col60_69)); } // full: if (val >= 70 && val <= 79) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col70_79)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col70_79)); } // full: if (val >= 80 && val <= 89) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col80_89)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col80_89)); } // full: if (val >= 90 && val <= 100) { Prog_batteryCapacityNotation.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col90_100)); Ellipse_center.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Coloring.col90_100)); } }