//Used to update the length visualisation and displys the bounding circle (using length as the radius) private void updateViews(TouchDevice callee) { // just want to know how WPF handles multi touches and events simulatenously(Observation: This states it is executed by Main: that means other threads just add the event to Main thread's queue :) ) //Console.WriteLine("Calling Thread: " + Thread.CurrentThread + " Is background Thread? : " + Thread.CurrentThread.IsBackground); //update the booleans if there are no blobs/tags if (noOfBlobs == 0) { blobDetected = false; } else { blobDetected = true; } if (noOfTags == 0) { tagDetected = false; } else { tagDetected = true; } Double distance = 0; //Drag the length displayer closer to the calling canvas's point lengthDisplayer.SetValue(Canvas.LeftProperty, (Double)callee.GetCenterPosition(this).X + 200); lengthDisplayer.SetValue(Canvas.TopProperty, (Double)callee.GetCenterPosition(this).Y + 10); //update length if (blobDetected) { TouchDevice blob = blobTouchDevices.FirstOrDefault(); //Console.WriteLine( "Blob List SIze" + blobTouchDevices.Count + " TAG List Size : " + tagTouchDevices.Count); if (noOfBlobs == 1 && noOfTags == 1) { distance = getDistance(blobTouchDevices[0].GetCenterPosition(this), tagTouchDevices[0].GetCenterPosition(this)); lengthDisplayer.Text = "Blob to Tag Distance: " + distance; if (!blob.Equals(callee)) { displayBoundingEllipse(distance, blob.GetCenterPosition(this)); } } else if (noOfBlobs == 2) { distance = getDistance(blobTouchDevices[0].GetCenterPosition(this), blobTouchDevices[1].GetCenterPosition(this)); lengthDisplayer.Text = "Blobs Distance: " + distance; displayBoundingEllipse(distance, blobTouchDevices[0].GetCenterPosition(this)); } } else if (tagDetected) {//no blobs detected if (noOfTags == 2) { distance = getDistance(tagTouchDevices[0].GetCenterPosition(this), tagTouchDevices[1].GetCenterPosition(this)); lengthDisplayer.Text = "Tags Distance: " + distance; TouchDevice bigTag; //We are not interested in the moving part's tag. As we use the bigger tag for updating center of the bounding circle if (tagTouchDevices[0] != callee) { bigTag = tagTouchDevices[0]; } else { bigTag = tagTouchDevices[1]; } displayBoundingEllipse(distance, bigTag.GetCenterPosition(this)); } } else { lengthDisplayer.Text = "Input not supported.\n OR \nToo few/many inputs. "; } }