Simply3DScan
ConfigurationControl.Places.cs
Go to the documentation of this file.
1 using System;
2 using SharedObjects;
3 using Configuration;
4 
5 namespace Simple3DScan.UI
6 {
7  partial class ConfigurationControl
8  {
12  [LogException]
13  private void InitPlacesValues()
14  {
15  string[] allowedFileFormats = { "Ascii", "Pcd" };
16 
17  int i = 0;
18 
19  foreach (string fileFormat in allowedFileFormats)
20  {
21  this.comboBoxFileFormat.Items.Add(fileFormat);
22 
23  if (this.configuration.Places.FileFormat.ToString() == fileFormat)
24  this.comboBoxFileFormat.SelectedIndex = i;
25  i++;
26  }
27 
28  this.comboBoxFileFormat.SelectedIndexChanged += this.comboBoxFileFormat_SelectedIndexChanged;
29 
30  this.textBoxImagePath.Text = this.configuration.Places.ImageSubPath;
31  this.textBoxLogPath.Text = this.configuration.Places.LogSubPath;
32  this.textBoxLastFilePath.Text = this.configuration.Places.LastFilePath;
33 
34  this.checkBoxSaveImages.Checked = this.configuration.Places.SaveImages;
35 
36  this.checkBoxSaveImages.CheckedChanged += this.CheckBoxSaveImagesOnCheckedChanged;
37  }
38 
44  [Log]
45  [LogException]
46  private void comboBoxFileFormat_SelectedIndexChanged(object sender, EventArgs e)
47  {
48  this.configuration.Places.FileFormat = EnumHelper.ParseEnum<FileFormat>(this.comboBoxFileFormat.Text);
49  }
50 
57  [Log]
58  [LogException]
59  private void CheckBoxSaveImagesOnCheckedChanged(object sender, EventArgs eventArgs)
60  {
61  this.configuration.Places.SaveImages = this.checkBoxSaveImages.Checked;
62  }
63 
64  [Log]
65  [LogException]
66  private void buttonLoadPathDefaults_Click(object sender, EventArgs e)
67  {
68  this.DetachPlacesEvents();
69  this.comboBoxFileFormat.Items.Clear();
70  this.configuration.Places = Config.CreateDefaultPlaces();
71  this.InitPlacesValues();
72  }
73 
74  private void DetachPlacesEvents()
75  {
76  this.comboBoxFileFormat.SelectedIndexChanged -= this.comboBoxFileFormat_SelectedIndexChanged;
77  this.checkBoxSaveImages.CheckedChanged -= this.CheckBoxSaveImagesOnCheckedChanged;
78  }
79  }
80 }
static Places CreateDefaultPlaces()
Creates the default places.
Definition: Config.cs:186
FileFormat
File output format
Definition: FileFormat.cs:6
Class for accessing the configuration.
Definition: Config.cs:12