示例#1
0
 public void UpdatePieChart(int warningValue, int timeoutValue)
 {
     xAxis.Clear();
     yAxis.Clear();
     if (PingTimes.Count > 0)
     {
         pingPlot.plt.Clear();
         var           successCount = (double)PingTimes.Values.Where(v => v > 0 && v < warningValue).Count();
         var           timeoutCount = (double)PingTimes.Values.Where(v => v == 0 || v >= timeoutValue).Count();
         var           warningCount = (double)PingTimes.Values.Where(v => v >= warningValue && v < timeoutValue).Count();
         List <double> values       = new List <double>
         {
             successCount
         };
         if (timeoutCount > 0)
         {
             values.Add(timeoutCount);
         }
         if (warningCount > 0)
         {
             values.Add(warningCount);
         }
         string[] labels = { "Success", "Timeout", "Warning" };
         System.Drawing.Color[] colors = { System.Drawing.Color.Green, System.Drawing.Color.Red, System.Drawing.Color.Orange };
         pingPlot.plt.PlotPie(values.ToArray(), labels, colors, showLabels: false, showPercentages: true);
         pingPlot.Render();
     }
 }
        public void Clear_NonEmptyList_CurrentSizeIsZero()
        {
            var list = new FixedList <int>(2);

            list.Append(10);
            list.Append(100);
            list.Clear();

            Assert.IsTrue(list.CurrentSize == 0);
        }
 private void ResetCountersBtn_Click(object sender, RoutedEventArgs e)
 {
     Timeouts   = 0;
     PacketLoss = 0.0;
     TotalPings = 0;
     Warnings   = 0;
     PingTimes.Clear();
     pingGraphControl.ClearData();
     statusGraphControl.ClearData();
     PingStatusBox.Text = string.Empty;
 }
        public void ClearTest()
        {
            FixedList <int> lst = new FixedList <int>(Size);

            Assert.Equal(0, lst.Count);
            for (int i = 1; i <= Size; i++)
            {
                lst.Add(i);
            }
            var expected = Enumerable.Range(1, 3 * Size);

            Assert.True(lst.SequenceEqual(expected.Skip(0).Take(Size)));
            lst.Clear();
            Assert.True(lst.SequenceEqual(new int[0]));
            Assert.Equal(0, lst.Count);
            Assert.Throws <IndexOutOfRangeException>(() => lst[0]);
        }
示例#5
0
 /// Stops any movement of players in this team
 /// and clears the step buffers
 public void resetFormation()
 {
     lastSpots.Clear();
     targetSpots = new Point[Player.Count];
 }