public override void SetUp() { _canvas = new Canvas(); _canvas.Background = new SolidColorBrush(Colors.White); _labels = new Label[LinesCount]; _window = new Window(); _window.Width = Width; _window.Height = Height; _window.Content = _canvas; _window.Background = new SolidColorBrush(Colors.Black); _window.Closed += OnWindowClosed; _window.Show(); for (int index = 0; index < _labels.Length; index++) { Color color = Color.FromArgb((byte)RandomInteger.NextInteger(255), (byte)RandomInteger.NextInteger(255), (byte)RandomInteger.NextInteger(255), (byte)RandomInteger.NextInteger(255)); _labels[index] = new Label(); _canvas.Children.Add(_labels[index]); _labels[index].Content = RandomDouble.NextDouble(1.0).ToString(); Canvas.SetLeft(_labels[index], RandomInteger.NextInteger(Width)); Canvas.SetTop(_labels[index], RandomInteger.NextInteger(Height)); } lastTick = System.Environment.TickCount; _frameTimer = new System.Windows.Threading.DispatcherTimer(); _frameTimer.Tick += OnFrame; _frameTimer.Interval = TimeSpan.FromSeconds(1.0 / 60.0); _frameTimer.Start(); }
private void AppendNewDataItems(int count) { for (int index = 0; index < count; index++) { _dataItems.Add(new DataItem() { Age = RandomInteger.NextInteger(100), Name = "Name #" + _dataItems.Count, RandomNumber = RandomDouble.NextDouble(1.0) * 1000 }); } }
public static BeaconV1 CreateBeacon() { return(new BeaconV1() { Id = RandomString.NextString(10, 20), SiteId = RandomString.NextString(10, 20), Type = RandomText.Word(), Udi = RandomString.NextString(10, 20), Label = RandomText.Word(), Center = new CenterObject(RandomText.Word(), new int[] { RandomInteger.NextInteger(1, 10), RandomInteger.NextInteger(1, 10) }), Radius = RandomDouble.NextDouble(100.0) }); }
private void OnFrame(object sender, EventArgs e) { currentTick = System.Environment.TickCount; elapsed = (double)(this.currentTick - this.lastTick) / 1000.0; lastTick = this.currentTick; frameCount++; frameCountTime += elapsed; if (frameCountTime >= 1.0) { frameCountTime -= 1.0; Context.IncrementCounter(frameCount); frameCount = 0; } for (int index = 0; index < _labels.Length; index++) { _labels[index].Content = RandomDouble.NextDouble(1.0).ToString(); Canvas.SetLeft(_labels[index], RandomInteger.NextInteger(Width)); Canvas.SetTop(_labels[index], RandomInteger.NextInteger(Height)); } }
private void OnFrame(object sender, EventArgs e) { this.currentTick = System.Environment.TickCount; this.elapsed = (double)(this.currentTick - this.lastTick) / 1000.0; this.lastTick = this.currentTick; frameCount++; frameCountTime += elapsed; if (frameCountTime >= 1.0) { frameCountTime -= 1.0; Context.IncrementCounter(frameCount); frameCount = 0; } if (GrowListOnly) { AppendNewDataItems(10); _window.ScrollTo(_dataItems.Count - 1); if (_dataItems.Count > ItemsCount) { _dataItems.Clear(); } } else { for (int index = 0; index < ItemsCount; index++) { _dataItems[index].Age = RandomInteger.NextInteger(100); _dataItems[index].Name = "Name #" + index + " - " + RandomInteger.NextInteger(1000); _dataItems[index].RandomNumber = RandomDouble.NextDouble(1.0) * 1000; } _window.ScrollTo(RandomInteger.NextInteger(ItemsCount - 1)); } }
protected double GetRandomValue() { return(RandomDouble.NextDouble(0, 100)); }
private BenchmarkInstance ChooseBenchmarkProportionally() { double selector = RandomDouble.NextDouble(1.0); return(_activeBenchmarks.FirstOrDefault(benchmark => benchmark.WithinRange(selector))); }