BioImager  5.0.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
Light.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9using System.Windows.Forms;
10
11namespace BioImager
12{
13 public partial class Light : Form
14 {
15 /* The constructor for the Light class. It initializes the GUI components, adds the light
16 sources to the lightBox, and sets the selected index to 0. It then calls the UpdateGUI
17 method. */
18 public Light()
19 {
20 InitializeComponent();
21 lightBox.Items.Add(Microscope.TLHalogen);
22 lightBox.Items.Add(Microscope.RLHalogen);
23 lightBox.Items.Add(Microscope.HXP);
24 lightBox.SelectedIndex = 0;
25 UpdateGUI();
26 }
28 public void UpdateGUI()
29 {
33 if (tl == 2)
34 tlShutterBox.Checked = true;
35 else if (tl == 1)
36 tlShutterBox.Checked = false;
37 if (rl == 2)
38 rlShutterBox.Checked = true;
39 else if (rl == 1)
40 rlShutterBox.Checked = false;
41 if (hxp == 2)
42 hxpShutterBox.Checked = true;
43 else if (hxp == 1)
44 hxpShutterBox.Checked = false;
45 percentLabel.Text = trackBar.Value + "%";
46 }
53 private void trackBar_Scroll(object sender, EventArgs e)
54 {
55 percentLabel.Text = trackBar.Value + "%";
56 LightSource l = (LightSource)lightBox.SelectedItem;
57 l.SetPosition(trackBar.Value);
58 }
59
65 private void tlShutterBox_CheckedChanged(object sender, EventArgs e)
66 {
67 if(tlShutterBox.Checked)
68 Microscope.TLShutter.SetPosition(2);
69 else
70 Microscope.TLShutter.SetPosition(1);
71 }
72
78 private void rlShutterBox_CheckedChanged(object sender, EventArgs e)
79 {
80 if (rlShutterBox.Checked)
81 Microscope.RLShutter.SetPosition(2);
82 else
83 Microscope.RLShutter.SetPosition(1);
84 }
85
91 private void hxpShutterBox_CheckedChanged(object sender, EventArgs e)
92 {
93 if (hxpShutterBox.Checked)
94 Microscope.HXPShutter.SetPosition(2);
95 else
96 Microscope.HXPShutter.SetPosition(1);
97 }
98
104 private void lightBox_SelectedIndexChanged(object sender, EventArgs e)
105 {
106 LightSource l = (LightSource)lightBox.SelectedItem;
107 if (l == null)
108 return;
109 int i = (int)l.GetPosition();
110 if (i != -1)
111 trackBar.Value = i;
112 }
113
118 private void Light_Activated(object sender, EventArgs e)
119 {
120 UpdateGUI();
121 }
122 }
123}
void UpdateGUI()
It updates the GUI to reflect the current state of the shutters.
Definition Light.cs:28
static LightSource HXP
static RLShutter RLShutter
static TLShutter TLShutter
static LightSource TLHalogen
static LightSource RLHalogen
static HXPShutter HXPShutter