/// <summary> /// Capture and act upon the 'capture' event, fired by the tracker. /// Can use this method to actually collect a value from the sensor. /// </summary> /// <param name="sender"></param> /// <param name="skel"></param> internal void capture(object sender, SkeletonPosition skel) { System.Diagnostics.Debug.WriteLine("Scan captured! END"); if (this.CaptureMode == (int)CaptureModes.Capture_New) { // Write location and timestamp to the database //initialise database class DatabaseEngine db = new DatabaseEngine(); DateTime timestamp = DateTime.Now; sharedPosition = skel; ((CoreLoader)(this.Owner)).savedLocation = sharedPosition; //add record to database //db.insertScanLocations("null", skel.jointName1, "null", skel.offsetXJ1, skel.offsetYJ1, "0", timestamp); Console.WriteLine("Writing to database! Values = " + skel.jointName1 + ", " + skel.offsetXJ1 + ", " + skel.offsetYJ1 + ", " + timestamp); } if (this.CaptureMode == (int)CaptureModes.Capture_Existing) { // Capture data from the scanner.... } tracker.stop(); this.Close(); }
} //parameterless version public ScanLoader(int mode) { InitializeComponent(); //Window Mode this.mode = mode; //Activate mouse down event handler this.hvpcanvas.MouseDown += new MouseButtonEventHandler(hvpcanvas_MouseDown); //Instantiate new database instance db = new DatabaseEngine(); if (this.mode == (int)OperationModes.ShowExistingCloud) { //hide buttons from form cancel_scan.Visibility = Visibility.Collapsed; start_scan.Visibility = Visibility.Collapsed; this.instructionblock.Visibility = Visibility.Collapsed; this.loadingwidgetcontrol.Visibility = Visibility.Visible; //center appropriately WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; this.Height = 480; this.Width = 640; //instantiate new joint depths dictionary. jointDepths = new Dictionary <JointType, double[]>(); } else if (this.mode == (int)OperationModes.ShowExistingResults) { //hide buttons from form cancel_scan.Visibility = Visibility.Collapsed; start_scan.Visibility = Visibility.Collapsed; this.instructionblock.Visibility = Visibility.Collapsed; this.loadingwidgetcontrol.Visibility = Visibility.Visible; //hide combobox numberOfScans.Visibility = Visibility.Collapsed; //center appropriately WindowStartupLocation = System.Windows.WindowStartupLocation.Manual; this.Top = 60; this.Left = (System.Windows.SystemParameters.PrimaryScreenWidth - this.Width) - 20; this.Height = 400; this.Width = 610; //instantiate new joint depths dictionary. jointDepths = new Dictionary <JointType, double[]>(); } else { cancel_scan.Visibility = Visibility.Visible; start_scan.Visibility = Visibility.Visible; this.instructionblock.Visibility = Visibility.Visible; this.loadingwidgetcontrol.Visibility = Visibility.Collapsed; } this.Loaded += new RoutedEventHandler(ScanLoader_Loaded); this.Show(); }
public CoreLoader() { //Initialize Component InitializeComponent(); //Initialize Database db = new DatabaseEngine(); //Initialize KinectInterpreter sandra = new SpeechSynthesizer(); sandra.Rate = 1; sandra.Volume = 100; kinectInterp = new KinectInterpreter(vpcanvas2); this.checkKinectIsOkay(); this.kinectmenu.IsEnabled = false; this.newscan.IsEnabled = false; //ui initialization this.WindowState = WindowState.Maximized; //Miscellaneous modelling definitions Model = new GeometryModel3D(); BaseModel = new GeometryModel3D(); //Set default working directory if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\PARSE")) { Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\PARSE"); } workingDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\PARSE"; this.resetButtons(); }
public ScanLoader( int mode ) { InitializeComponent(); //Window Mode this.mode = mode; //Activate mouse down event handler this.hvpcanvas.MouseDown += new MouseButtonEventHandler(hvpcanvas_MouseDown); //Instantiate new database instance db = new DatabaseEngine(); if (this.mode == (int)OperationModes.ShowExistingCloud) { //hide buttons from form cancel_scan.Visibility = Visibility.Collapsed; start_scan.Visibility = Visibility.Collapsed; this.instructionblock.Visibility = Visibility.Collapsed; this.loadingwidgetcontrol.Visibility = Visibility.Visible; //center appropriately WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; this.Height = 480; this.Width = 640; //instantiate new joint depths dictionary. jointDepths = new Dictionary<JointType, double[]>(); } else if(this.mode == (int)OperationModes.ShowExistingResults) { //hide buttons from form cancel_scan.Visibility = Visibility.Collapsed; start_scan.Visibility = Visibility.Collapsed; this.instructionblock.Visibility = Visibility.Collapsed; this.loadingwidgetcontrol.Visibility = Visibility.Visible; //hide combobox numberOfScans.Visibility = Visibility.Collapsed; //center appropriately WindowStartupLocation = System.Windows.WindowStartupLocation.Manual; this.Top = 60; this.Left = (System.Windows.SystemParameters.PrimaryScreenWidth - this.Width) - 20; this.Height = 400; this.Width = 610; //instantiate new joint depths dictionary. jointDepths = new Dictionary<JointType, double[]>(); } else { cancel_scan.Visibility = Visibility.Visible; start_scan.Visibility = Visibility.Visible; this.instructionblock.Visibility = Visibility.Visible; this.loadingwidgetcontrol.Visibility = Visibility.Collapsed; } this.Loaded += new RoutedEventHandler(ScanLoader_Loaded); this.Show(); }