private async void Button4_Click(object sender, RoutedEventArgs e) { if (_Running) // Stop { StopRunning(); } else if (_Pozyx.Anchors.Count >= 4) // Start { DisableButtons(); await _Pozyx.SetRecommendedConfigurations(); await Task.Delay(1000); _Pozyx.ConfigurationRegisters.PosAlg(4, 3, _FriendId); this.StartRunning(); EnableButtons(); } else { this.Output.Text = "Set anchors first"; } }
/// <summary> /// Perform the test. Automatically exports to pdf /// </summary> /// <param name="timeSpan">Timespan in ms the test will run</param> /// <param name="interval">Update interval</param> /// <param name="testCase">Name of testcase</param> /// <param name="catagory">catagory of the testcase</param> /// <returns></returns> public async Task DoTest(int timeSpan, int interval, string testCase, string category, string[] description) { this.Status = "Setting configurations"; await _Pozyx.SetRecommendedConfigurations(); this.MyPosition = new Position(2050, 1020, 840); startTime = DateTime.Now; this.PositionsList = new List <Position>(); this.TestCase = testCase; this.TimeSpan = timeSpan; this.Description = description; this.Category = category; DateTime stopTime = DateTime.Now.AddMilliseconds(timeSpan); TimeSpan difference; ZeroCount = 0; Position position; while (DateTime.Now < stopTime) { difference = (stopTime - DateTime.Now); this.Status = difference.Minutes + ":" + difference.Seconds; position = _Pozyx.PositioningData.Pos(); if (position.X == 0 && position.Y == 0 && position.Z == 0) { ZeroCount++; } PositionsList.Add(position); await Task.Delay(interval); } this.Status = "Exporting"; TestResult = UpdateTestResult(); await this.Export(); }