private void CreateCommandClick(object obj) { try { if (!IPAddress.TryParse(ipV4string, out IPAddress ipV4parsed)) { MessageBox.Show("IP address mst be in v4 format eg: 192.168.0.1", "IP address invalid", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (!PoseDtoFactory.TryParseString(poseString, out _)) { MessageBox.Show("Pose must be in the format: xx,yy,hh", "Pose string invalid", MessageBoxButton.OK, MessageBoxImage.Error); return; } AGVTemplate template = new AGVTemplate() { IPV4String = ipV4parsed.ToString(), PoseDataString = poseString }; Model.FleetTemplate.Add(template); } catch (Exception ex) { Logger.Error(ex); } }
protected override IServiceCallResult HandleExecution(IFleetManagerClient client) { IPAddress ipAddress = IPAddress.Parse(IPv4String); PoseDtoFactory.TryParseString(PoseString, out PoseDto poseData); return(client.SetPose(ipAddress, poseData ?? PoseDtoFactory.NaNPose)); }
public void ParseString(double x, double y, double heading) { foreach (string subString in FormattedStrings(x, y, heading)) { PoseDto pose = PoseDtoFactory.ParseString(subString); Assert.AreEqual(x, pose.X); Assert.AreEqual(y, pose.Y); Assert.AreEqual(heading, pose.Heading); } }