2 using System.Drawing.Imaging;
7 using Syncfusion.Windows.Forms.Tools;
37 this.InitializeComponent();
49 this.
Arduino.ActivateLaser(
false);
52 this.toggleButtonLaser.Renderer = styleRenderer;
53 this.toggleButtonLight.Renderer = styleRenderer;
66 private void toggleButtonLaser_Click(
object sender, EventArgs e)
68 this.
Arduino.ActivateLaser(this.toggleButtonLaser.ToggleState != ToggleButtonState.Active);
78 private void buttonDetectLaser_Click(
object sender, EventArgs e)
80 this.imagingControl.FilterLaser = !this.imagingControl.FilterLaser;
90 private void buttonCCW_Click(
object sender, EventArgs e)
92 this.
Arduino.RotateTurnTableCcw(100);
102 private void buttonCW_Click(
object sender, EventArgs e)
104 this.
Arduino.RotateTurnTableCw(100);
114 private void buttonLaserCCW_Click(
object sender, EventArgs e)
116 this.
Arduino.RotateLaserCcw(10);
126 private void buttonLaserCW_Click(
object sender, EventArgs e)
128 this.
Arduino.RotateLaserCw(10);
138 private void toggleButtonLight_Click(
object sender, EventArgs e)
140 if (this.toggleButtonLight.ToggleState != ToggleButtonState.Active)
141 this.
Arduino.ActivateLight(
true, 10);
143 this.
Arduino.ActivateLight(
false, 0);
153 private void buttonStartCamera_Click(
object sender, EventArgs e)
155 this.imagingControl.LaserLeftPosition = this.ConfigurationInformation.Laser.SwipeMin * this.ConfigurationInformation.Camera.Width / 100;
156 this.imagingControl.LaserRightPosition = this.ConfigurationInformation.Laser.SwipeMax * this.ConfigurationInformation.Camera.Width / 100;
158 this.imagingControl.StartImaging(this.ConfigurationInformation.Camera.Name);
168 private void buttonStopCamera_Click(
object sender, EventArgs e)
170 this.imagingControl.StopImaging();
180 private void buttonSaveImage_Click(
object sender, EventArgs e)
182 Image image = this.imagingControl.GetNextPicture();
186 SaveFileDialog saveImageDialog =
new SaveFileDialog
188 FileName =
"Image_" + DateTime.Now.ToFileTime(),
190 Filter =
"Images (.png)|*.png"
192 DialogResult result = saveImageDialog.ShowDialog();
194 if (result != DialogResult.OK)
197 string filename = saveImageDialog.FileName;
198 image.Save(filename, ImageFormat.Png);
211 this.imagingControl.StopImaging();
221 this.imagingControl.StartImaging(this.ConfigurationInformation.Camera.Name);
232 protected override void Dispose(
bool disposing)
236 this.components?.Dispose();
238 this.imagingControl.StopImaging();
240 base.Dispose(disposing);
Manual Control of arduino and imaging
Class for detecting an arduino and sending commands to it
Class holding configuration to access an arduino
ManualControl()
Initializes a new instance of the ManualControl class.
void Start()
Starts this instance.
override void Dispose(bool disposing)
Class for creating a singleton for a generic class
void Init(ArduinoCommands arduino)
Initializes the control.
static T Instance
Gets the instance.
void Stop()
Stops this instance.