Simply3DScan
ConfigurationControl.Laser.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 InitLaserValues()
14  {
15  this.textBoxLaserX.Text = this.configuration.Laser.WorldCoordinates.X.ToString(CultureInfo.InvariantCulture);
16  this.textBoxLaserX.TextChanged += this.TextBoxLaserXOnTextChanged;
17 
18  this.textBoxLaserY.Text = this.configuration.Laser.WorldCoordinates.Y.ToString(CultureInfo.InvariantCulture);
19  this.textBoxLaserY.TextChanged += this.TextBoxLaserYOnTextChanged;
20 
21  this.textBoxLaserZ.Text = this.configuration.Laser.WorldCoordinates.Z.ToString(CultureInfo.InvariantCulture);
22  this.textBoxLaserZ.TextChanged += this.TextBoxLaserZOnTextChanged;
23 
24  this.numericUpperRange.Value = (int) this.configuration.Laser.UpperRange;
25  this.numericUpperRange.ValueChanged += this.NumericUpperRangeOnValueChanged;
26 
27  this.numericLowerRange.Value = (int) this.configuration.Laser.LowerRange;
28  this.numericLowerRange.ValueChanged += this.NumericLowerRangeOnValueChanged;
29 
30  this.numericOffset.Value = this.configuration.Laser.Offset;
31  this.numericOffset.ValueChanged += this.NumericOffsetOnValueChanged;
32 
33  this.checkBoxMotorEnabled.Checked = this.configuration.Laser.MotorEnabled;
34  this.checkBoxMotorEnabled.CheckStateChanged += this.CheckBoxMotorEnabledOnCheckStateChanged;
35 
36  this.numericSwipeMin.Value = (int)this.configuration.Laser.SwipeMin;
37  this.numericSwipeMin.ValueChanged += this.NumericSwipeMinOnValueChanged;
38 
39  this.numericSwipeMax.Value = (int) this.configuration.Laser.SwipeMax;
40  this.numericSwipeMax.ValueChanged += this.NumericSwipeMaxOnValueChanged;
41  }
42 
48  [Log]
49  [LogException]
50  private void TextBoxLaserXOnTextChanged(object sender, EventArgs eventArgs)
51  {
52  this.configuration.Laser.WorldCoordinates.X = float.Parse(this.textBoxLaserX.Text);
53  }
54 
60  [Log]
61  [LogException]
62  private void TextBoxLaserYOnTextChanged(object sender, EventArgs eventArgs)
63  {
64  this.configuration.Laser.WorldCoordinates.Y = float.Parse(this.textBoxLaserY.Text);
65  }
66 
72  [Log]
73  [LogException]
74  private void TextBoxLaserZOnTextChanged(object sender, EventArgs eventArgs)
75  {
76  this.configuration.Laser.WorldCoordinates.Z = float.Parse(this.textBoxLaserZ.Text);
77  }
78 
84  [Log]
85  [LogException]
86  private void NumericUpperRangeOnValueChanged(object sender, EventArgs eventArgs)
87  {
88  this.configuration.Laser.UpperRange = (float)this.numericUpperRange.Value;
89  }
90 
96  [Log]
97  [LogException]
98  private void NumericLowerRangeOnValueChanged(object sender, EventArgs eventArgs)
99  {
100  this.configuration.Laser.LowerRange = (float)this.numericLowerRange.Value;
101  }
102 
108  [Log]
109  [LogException]
110  private void NumericOffsetOnValueChanged(object sender, EventArgs eventArgs)
111  {
112  this.configuration.Laser.Offset = (int)this.numericOffset.Value;
113  }
114 
120  [Log]
121  [LogException]
122  private void CheckBoxMotorEnabledOnCheckStateChanged(object sender, EventArgs eventArgs)
123  {
124  this.configuration.Laser.MotorEnabled = this.checkBoxMotorEnabled.Checked;
125  }
126 
132  [Log]
133  [LogException]
134  private void NumericSwipeMinOnValueChanged(object sender, EventArgs eventArgs)
135  {
136  this.configuration.Laser.SwipeMin = (float)this.numericSwipeMin.Value;
137  }
138 
145  [Log]
146  [LogException]
147  private void NumericSwipeMaxOnValueChanged(object sender, EventArgs eventArgs)
148  {
149  this.configuration.Laser.SwipeMax = (float)this.numericSwipeMax.Value;
150  }
151 
152  [Log]
153  [LogException]
154  private void buttonLoadLaserDefaults_Click(object sender, EventArgs e)
155  {
156  this.DetachLaserEvents();
157  this.configuration.Laser = Configuration.Config.CreateDefaultLaser();
158  this.InitLaserValues();
159  }
160 
161  private void DetachLaserEvents()
162  {
163  this.textBoxLaserX.TextChanged -= this.TextBoxLaserXOnTextChanged;
164  this.textBoxLaserY.TextChanged -= this.TextBoxLaserYOnTextChanged;
165  this.textBoxLaserZ.TextChanged -= this.TextBoxLaserZOnTextChanged;
166  this.numericUpperRange.ValueChanged -= this.NumericUpperRangeOnValueChanged;
167  this.numericLowerRange.ValueChanged -= this.NumericLowerRangeOnValueChanged;
168  this.numericOffset.ValueChanged -= this.NumericOffsetOnValueChanged;
169  this.checkBoxMotorEnabled.CheckStateChanged -= this.CheckBoxMotorEnabledOnCheckStateChanged;
170  this.numericSwipeMin.ValueChanged -= this.NumericSwipeMinOnValueChanged;
171  this.numericSwipeMax.ValueChanged -= this.NumericSwipeMaxOnValueChanged;
172  }
173  }
174 }
static Laser CreateDefaultLaser()
Creates the default laser.
Definition: Config.cs:128
Class for accessing the configuration.
Definition: Config.cs:12