Simply3DScan
ConfigurationControl.Turntable.cs
Go to the documentation of this file.
1 using System;
2 using System.Globalization;
3 using SharedObjects;
4 
5 namespace Simple3DScan.UI
6 {
7  partial class ConfigurationControl
8  {
12  [LogException]
13  private void InitTurnTableValues()
14  {
15  this.textBoxTableX.Text = this.configuration.Turntable.WorldCoordinates.X.ToString(CultureInfo.InvariantCulture);
16  this.textBoxTableX.TextChanged += this.TextBoxTableXOnTextChanged;
17 
18  this.textBoxTableY.Text = this.configuration.Turntable.WorldCoordinates.Y.ToString(CultureInfo.InvariantCulture);
19  this.textBoxTableY.TextChanged += this.TextBoxTableYOnTextChanged;
20 
21  this.textBoxTableZ.Text = this.configuration.Turntable.WorldCoordinates.Z.ToString(CultureInfo.InvariantCulture);
22  this.textBoxTableZ.TextChanged += this.TextBoxTableZOnTextChanged;
23 
24  this.textBoxRadius.Text = this.configuration.Turntable.Radius.ToString(CultureInfo.InvariantCulture);
25  this.textBoxRadius.TextChanged += this.TextBoxRadiusOnTextChanged;
26 
27  this.numericSafetyDistance.Value = this.configuration.Turntable.SafetyDistance;
28  this.numericSafetyDistance.ValueChanged += this.NumericSafetyDistanceOnValueChanged;
29 
30  this.numericSteps.Value = this.configuration.Motor.Steps;
31  this.numericSteps.ValueChanged += this.NumericStepsOnValueChanged;
32 
33  this.numericMicroSteps.Value = this.configuration.Motor.MicroSteps;
34  this.numericMicroSteps.ValueChanged += this.NumericMicroStepsOnValueChanged;
35 
36  this.checkBoxMicroStepsEnabled.Checked = this.configuration.Motor.MicroStepsEnabled;
37  this.checkBoxMicroStepsEnabled.CheckStateChanged += this.CheckBoxMicroStepsEnabledOnCheckStateChanged;
38  }
39 
45  [Log]
46  [LogException]
47  private void TextBoxTableXOnTextChanged(object sender, EventArgs eventArgs)
48  {
49  this.configuration.Turntable.WorldCoordinates.X = float.Parse(this.textBoxTableX.Text);
50  }
51 
57  [Log]
58  [LogException]
59  private void TextBoxTableYOnTextChanged(object sender, EventArgs eventArgs)
60  {
61  this.configuration.Turntable.WorldCoordinates.Y = float.Parse(this.textBoxTableY.Text);
62  }
63 
69  [Log]
70  [LogException]
71  private void TextBoxTableZOnTextChanged(object sender, EventArgs eventArgs)
72  {
73  this.configuration.Turntable.WorldCoordinates.Z = float.Parse(this.textBoxTableZ.Text);
74  }
75 
82  [Log]
83  [LogException]
84  private void TextBoxRadiusOnTextChanged(object sender, EventArgs eventArgs)
85  {
86  this.configuration.Turntable.Radius = float.Parse(this.textBoxRadius.Text);
87  }
88 
95  [Log]
96  [LogException]
97  private void NumericSafetyDistanceOnValueChanged(object sender, EventArgs eventArgs)
98  {
99  this.configuration.Turntable.SafetyDistance = (int)this.numericSafetyDistance.Value;
100  }
101 
107  [Log]
108  [LogException]
109  private void NumericStepsOnValueChanged(object sender, EventArgs eventArgs)
110  {
111  this.configuration.Motor.Steps = (int) this.numericSteps.Value;
112  }
113 
119  [Log]
120  [LogException]
121  private void NumericMicroStepsOnValueChanged(object sender, EventArgs eventArgs)
122  {
123  this.configuration.Motor.MicroSteps = (int) this.numericMicroSteps.Value;
124  }
125 
131  [Log]
132  [LogException]
133  private void CheckBoxMicroStepsEnabledOnCheckStateChanged(object sender, EventArgs eventArgs)
134  {
135  this.configuration.Motor.MicroStepsEnabled = this.checkBoxMicroStepsEnabled.Checked;
136  }
137 
138  [Log]
139  [LogException]
140  private void buttonLoadTurntableDefauts_Click(object sender, EventArgs e)
141  {
142  this.DetachTurntableEvents();
143  this.configuration.Motor = Configuration.Config.CreateDefaultMotor();
144  this.configuration.Turntable = Configuration.Config.CreateDefaultTurntable();
145  this.InitTurnTableValues();
146  }
147 
148  private void DetachTurntableEvents()
149  {
150  this.textBoxTableX.TextChanged -= this.TextBoxTableXOnTextChanged;
151  this.textBoxTableY.TextChanged -= this.TextBoxTableYOnTextChanged;
152  this.textBoxTableZ.TextChanged -= this.TextBoxTableZOnTextChanged;
153  this.textBoxRadius.TextChanged -= this.TextBoxRadiusOnTextChanged;
154  this.numericSafetyDistance.ValueChanged -= this.NumericSafetyDistanceOnValueChanged;
155  this.numericSteps.ValueChanged -= this.NumericStepsOnValueChanged;
156  this.numericMicroSteps.ValueChanged -= this.NumericMicroStepsOnValueChanged;
157  this.checkBoxMicroStepsEnabled.CheckStateChanged -= this.CheckBoxMicroStepsEnabledOnCheckStateChanged;
158  }
159  }
160 }
static Motor CreateDefaultMotor()
Creates the default motor.
Definition: Config.cs:114
static Turntable CreateDefaultTurntable()
Creates the default turntable.
Definition: Config.cs:146
Class for accessing the configuration.
Definition: Config.cs:12