private void start_scan_Click(object sender, RoutedEventArgs e)
        {
            this.CaptureMode = (int)CaptureModes.Capture_New;

            // hide buttons from form
            //cancel_scan.Visibility = Visibility.Collapsed;
            start_scan.Visibility = Visibility.Collapsed;
            rescanButton.Visibility = Visibility.Collapsed;

            // show image & instructions
            Visualisation.Visibility = Visibility.Visible;
            instructionblock.Visibility = Visibility.Collapsed;
            instructionblock2.Text = "Loading...";
            instructionblock2.Visibility = Visibility.Visible;

            // TODO move the button to the edge but keep it visible
            cancel_scan.Visibility = Visibility.Hidden;

            System.Diagnostics.Debug.WriteLine("Starting measurement window...");

            // Start tracking
            tracker = new SensorTracker(Visualisation, this, instructionblock2);
            tracker.captureNewLocation();
            //tracker.captureAtLocation();

            // Hook up to the capture event, fired by the tracker.
            tracker.Capture += new SensorTracker.CaptureEventHandler(capture);
        }
        private void scan_existing_Click(object sender, RoutedEventArgs e)
        {
            this.CaptureMode = (int)CaptureModes.Capture_Existing;

            // hide buttons from form
            //cancel_scan.Visibility = Visibility.Collapsed;
            start_scan.Visibility = Visibility.Collapsed;
            rescanButton.Visibility = Visibility.Collapsed;

            // show image & instructions
            Visualisation.Visibility = Visibility.Visible;
            instructionblock.Visibility = Visibility.Collapsed;
            instructionblock2.Text = "Loading...";
            instructionblock2.Visibility = Visibility.Visible;

            // TODO move the button to the edge but keep it visible
            cancel_scan.Visibility = Visibility.Hidden;

            System.Diagnostics.Debug.WriteLine("Starting measurement window...");

            // Start tracking
            tracker = new SensorTracker(Visualisation, this, instructionblock2);
            //tracker.captureNewLocation();

            // Get a position from the database
            SkeletonPosition targetLocation = new SkeletonPosition();

            /*DatabaseEngine db = new DatabaseEngine();
            Tuple<int, String, double, double, DateTime> scanloc = db.getLatestScanLoc();

            targetLocation.jointName1 = scanloc.Item2;
            targetLocation.offsetXJ1 = scanloc.Item3;
            targetLocation.offsetYJ1 = scanloc.Item4;*/

            targetLocation = ((CoreLoader)(this.Owner)).savedLocation;

            tracker.captureAtLocation(targetLocation);

            // Hook up to the capture event, fired by the tracker.
            tracker.Capture += new SensorTracker.CaptureEventHandler(capture);
        }