private void button3_Click(object sender, RoutedEventArgs e) { this.Hide(); DateTime curTime = DateTime.Now; //retrieve as an anonymous object type Object activeRecord = listBox1.SelectedItems[0]; //access attributes through reflection dynamic d = activeRecord; object id = d.Id; object nm = d.Patientname; object nhs = d.Patientnhsno; int patientID = Convert.ToInt32(id); db.insertScans(1, patientID, System.IO.Path.Combine(workingDir, patientID + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), "", curTime); //save scan to .parse file in the working directory ScanSerializer.serialize(Path.Combine(workingDir, patientID + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), pcdl); //confirm save MessageBoxResult result = System.Windows.MessageBox.Show(this, "Patient saved to database", "Patient Scan Saved", MessageBoxButton.OK, MessageBoxImage.Information); }
/// <summary> /// exports a scan into the infamous .PARSE format /// </summary> /// <param name="sender">the object</param> /// <param name="e">the routed event</param> private void ExportScan_Click(object sender, RoutedEventArgs e) { /*ExportScan serializes the visualisation object, once the pointcloud * structure has been implemented, it will serialize the pc object * rather than this visualisation. Current issue, cant serialize list * objects that contain arrays apparantely.*/ Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.DefaultExt = ".PARSE"; dlg.Filter = "PARSE Reference Data (.PARSE)|*.PARSE"; if (dlg.ShowDialog() == true) { String filename = dlg.FileName; ScanSerializer.serialize(filename, windowScanner.getPointClouds()); this.export1.IsEnabled = false; } }
private void SaveScan_Click(object sender, RoutedEventArgs e) { //Test if patientloader is currently active and then attribute the scan to them. //Otherwise if this is not the case, we need to manually attribute the scan to //a patient. DateTime curTime = DateTime.Now; if (windowPatient == null) { windowMeta = new MetaLoader(); windowMeta.WindowStartupLocation = WindowStartupLocation.CenterScreen; windowMeta.Owner = this; //save specific actions. windowMeta.setWorkingDir(workingDir); windowMeta.setPC(pcdl); windowMeta.Title = "Attribute scan to whom?"; windowMeta.button1.Visibility = Visibility.Collapsed; windowMeta.button2.Visibility = Visibility.Collapsed; windowMeta.button3.Visibility = Visibility.Visible; windowMeta.Show(); } else { int currentPatient = Convert.ToInt32(windowPatient.patientIDExisting.Content); //save to db and workingdirectory with appropriate id. db.insertScans(1, currentPatient, System.IO.Path.Combine(workingDir, currentPatient + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), "", curTime); //save scan to .parse file in the working directory ScanSerializer.serialize(System.IO.Path.Combine(workingDir, currentPatient + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), pcdl); MessageBoxResult result = System.Windows.MessageBox.Show(this, "Patient saved to database", "Patient Scan Saved", MessageBoxButton.OK, MessageBoxImage.Information); } }