public void LoadPointCloud() { // Show the window first - keep UI FAST speedy is a stupid word. System.Diagnostics.Debug.WriteLine("Showing window"); shutAnyWindows(); windowScanner = new ScanLoader((int)ScanLoader.OperationModes.ShowExistingResults); windowScanner.Owner = this; // Do UI stuff on UI thread this.export1.IsEnabled = false; this.export2.IsEnabled = true; this.removefloor.IsEnabled = true; //define //windowHistory = new HistoryLoader(); //windowHistory.Owner = this; // Background thread to get all the heavy computation off of the UI thread BackgroundWorker B = new BackgroundWorker(); B.DoWork += new DoWorkEventHandler(loadScanThread); // Catch the progress update events B.WorkerReportsProgress = true; B.ProgressChanged += new ProgressChangedEventHandler((obj, args) => { windowScanner.loadingwidgetcontrol.UpdateProgressBy(args.ProgressPercentage); if (args.UserState != null) { if (args.UserState is string) { System.Diagnostics.Debug.WriteLine((string)args.UserState); } else if (args.UserState is Action) { ((Action)args.UserState)(); } } }); B.RunWorkerCompleted += new RunWorkerCompletedEventHandler((obj, args) => { windowScanner.processCloudList(pcdl, windowScanner.loadingwidgetcontrol); }); // GOOO!!! Pass the file name so it can be loaded B.RunWorkerAsync(filename); }
/// <summary> /// fine tunes the point cloud (just removes floor) /// </summary> /// <param name="sender">the object</param> /// <param name="e">the routed event</param> private void RemoveFeet_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < pcdl.Count; i++) { pcdl[i].deleteFloor(); if ((this.windowPatient.nameText.Text.CompareTo("Greg Corbett")) == 0) { pcdl[i].deleteFloor(); //again } } this.calculate.IsEnabled = true; this.measurement.IsEnabled = true; this.shutAnyWindows(); windowScanner = new ScanLoader((int)ScanLoader.OperationModes.ShowExistingResults); windowScanner.Owner = this; // Do UI stuff on UI thread this.export1.IsEnabled = false; this.export2.IsEnabled = false; this.removefloor.IsEnabled = true; //define windowHistory = new HistoryLoader(); windowHistory.Owner = this; windowHistory.history.Visibility = Visibility.Collapsed; // Background thread to get all the heavy computation off of the UI thread /* * BackgroundWorker B = new BackgroundWorker(); */ //TODO Confirm we don't need this - the point cloud is loaded and stitched already? //B.DoWork += new DoWorkEventHandler(loadScanThread); /* * // Catch the progress update events * B.WorkerReportsProgress = true; * B.ProgressChanged += new ProgressChangedEventHandler((obj, args) => * { * windowScanner.loadingwidgetcontrol.UpdateProgressBy(args.ProgressPercentage); * if (args.UserState != null) * { * if (args.UserState is string) * { * System.Diagnostics.Debug.WriteLine((string)args.UserState); * } * else if (args.UserState is Action) * { * ((Action)args.UserState)(); * } * } * }); * B.RunWorkerCompleted += new RunWorkerCompletedEventHandler((obj, args) => * {*/ windowScanner.processCloudList(pcdl, windowScanner.loadingwidgetcontrol); /* * }); * * * // GOOO!!! Pass the file name so it can be loaded * B.RunWorkerAsync(null); */ }