/// <summary> /// Create a dialog that prompts the user to enter something /// </summary> /// <returns></returns> private string getuserinput() { string text = "Scan or enter kit barcodes seperated by a ';'"; // Create a new ScanInput form using (var f = new ScanInput(text)) { var result = f.ShowDialog(); if (!(result == DialogResult.OK)) { // User canceled or closed the dialog return(null); } else { if (string.IsNullOrWhiteSpace(f.Input) || string.IsNullOrEmpty(f.Input)) { MessageBox.Show("You didn't enter anything!", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } return(f.Input); } } }
public async Task <IActionResult> Post([FromBody] ScanInput input) { var scanId = Guid.NewGuid(); _logger.LogInformation("Starting scan {scanId}, text: {text}", scanId, input.Text); var result = await _matcher.FindSystemMatches(input.Text); _logger.LogInformation("Finished scan {scanId}, results: {results}", scanId, result.Count); return(Ok(result)); }
protected override JobHandle OnUpdate(JobHandle handle) { var touches = Input.touches .Where(touch => touch.phase == TouchPhase.Began) .Select(touch => new TouchInfo { Pos = touch.position, TouchId = touch.fingerId, }) .ToList(); if (Input.GetMouseButtonDown(0)) { touches.Add(new TouchInfo { Pos = Input.mousePosition, TouchId = -2, }); } if (touches.Count == 0) { return(handle); } var commandBuffer = commandBufferSystem.CreateCommandBuffer(); var filter = CollisionFilter.Default; filter.CollidesWith = 1u << 1; var rays = new NativeArray <ScanInput>(touches.Count, Allocator.TempJob); for (int i = 0; i < touches.Count; i++) { var dragStartPoint = touches[i]; var ray = Camera.main.ScreenPointToRay(dragStartPoint.Pos); var raycastInput = new RaycastInput { Start = ray.origin, End = ray.origin + ray.direction * 100f, Filter = filter, }; rays[i] = new ScanInput { RaycastInput = raycastInput, TouchId = dragStartPoint.TouchId, }; } var collisionWorld = physicsWorld.PhysicsWorld.CollisionWorld; handle = JobHandle.CombineDependencies(handle, physicsWorld.FinalJobHandle); handle = Job .WithCode(() => { for (int i = 0; i < rays.Length; i++) { Unity.Physics.RaycastHit hit; var scanInput = rays[i]; if (!collisionWorld.CastRay(scanInput.RaycastInput, out hit)) { continue; } ; var entity = hit.Entity; commandBuffer.SetComponent(entity, new TappableData { Tapped = true, TouchId = scanInput.TouchId, }); } }) .WithDeallocateOnJobCompletion(rays) .Schedule(handle); handle.Complete(); return(handle); }