Spring – Diff between revs 1 and 2
?pathlinks?
Rev 1 | Rev 2 | |||
---|---|---|---|---|
1 | using System; |
1 | using System; |
|
2 | using System.ComponentModel; |
2 | using System.ComponentModel; |
|
3 | using System.Drawing; |
3 | using System.Drawing; |
|
4 | using System.Text.RegularExpressions; |
4 | using System.Text.RegularExpressions; |
|
5 | using System.Windows.Forms; |
5 | using System.Windows.Forms; |
|
6 | using Spring.Properties; |
6 | using Spring.Properties; |
|
7 | |
7 | |
|
8 | namespace Spring.Settings |
8 | namespace Spring.Settings |
|
9 | { |
9 | { |
|
10 | public partial class SettingsForm : Form |
10 | public partial class SettingsForm : Form |
|
11 | { |
11 | { |
|
12 | #region Public Enums, Properties and Fields |
12 | #region Public Enums, Properties and Fields |
|
13 | |
13 | |
|
14 | public BindingList<string> WhitelistBinding { get; set; } |
14 | public BindingList<string> WhitelistBinding { get; set; } |
|
15 | |
15 | |
|
16 | #endregion |
16 | #endregion |
|
17 | |
17 | |
|
18 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
18 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
|
19 | |
19 | |
|
20 | private Region PanelRegion { get; set; } |
20 | private Region PanelRegion { get; set; } |
|
21 | |
21 | |
|
22 | private Graphics PanelGraphics { get; set; } |
22 | private Graphics PanelGraphics { get; set; } |
|
23 | |
23 | |
|
24 | private SolidBrush PanelSolidColorBrush { get; set; } |
24 | private SolidBrush PanelSolidColorBrush { get; set; } |
|
25 | |
25 | |
|
26 | private RectangleF PanelBounds { get; } |
26 | private RectangleF PanelBounds { get; } |
|
27 | |
27 | |
|
28 | private Configuration.Configuration Configuration { get; } |
28 | private Configuration.Configuration Configuration { get; } |
|
29 | |
29 | |
|
30 | #endregion |
30 | #endregion |
|
31 | |
31 | |
|
32 | #region Constructors, Destructors and Finalizers |
32 | #region Constructors, Destructors and Finalizers |
|
33 | |
33 | |
|
34 | /// <summary> |
34 | /// <summary> |
|
35 | /// Clean up any resources being used. |
35 | /// Clean up any resources being used. |
|
36 | /// </summary> |
36 | /// </summary> |
|
37 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
37 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
|
38 | protected override void Dispose(bool disposing) |
38 | protected override void Dispose(bool disposing) |
|
39 | { |
39 | { |
|
40 | if (disposing && components != null) |
40 | if (disposing && components != null) |
|
41 | { |
41 | { |
|
42 | PanelRegion?.Dispose(); |
42 | PanelRegion?.Dispose(); |
|
43 | PanelRegion = null; |
43 | PanelRegion = null; |
|
44 | |
44 | |
|
45 | PanelGraphics?.Dispose(); |
45 | PanelGraphics?.Dispose(); |
|
46 | PanelGraphics = null; |
46 | PanelGraphics = null; |
|
47 | |
47 | |
|
48 | PanelSolidColorBrush?.Dispose(); |
48 | PanelSolidColorBrush?.Dispose(); |
|
49 | PanelSolidColorBrush = null; |
49 | PanelSolidColorBrush = null; |
|
50 | |
50 | |
|
51 | components.Dispose(); |
51 | components.Dispose(); |
|
52 | } |
52 | } |
|
53 | |
53 | |
|
54 | base.Dispose(disposing); |
54 | base.Dispose(disposing); |
|
55 | } |
55 | } |
|
56 | |
56 | |
|
57 | public SettingsForm(Configuration.Configuration springConfiguration) : this() |
57 | public SettingsForm(Configuration.Configuration springConfiguration) : this() |
|
58 | { |
58 | { |
|
59 | Configuration = springConfiguration; |
59 | Configuration = springConfiguration; |
|
60 | |
60 | |
|
61 | WhitelistBinding = new BindingList<string>(Configuration.HUD.WhiteList.Whitelist); |
61 | WhitelistBinding = new BindingList<string>(Configuration.HUD.WhiteList.Whitelist); |
|
62 | windowWhiteListListBox.DataSource = WhitelistBinding; |
62 | windowWhiteListListBox.DataSource = WhitelistBinding; |
|
63 | |
63 | |
|
64 | enableWindowWhiteListCheckBox.DataBindings.Add(nameof(enableWindowWhiteListCheckBox.Checked), |
64 | enableWindowWhiteListCheckBox.DataBindings.Add(nameof(enableWindowWhiteListCheckBox.Checked), |
|
65 | Configuration.HUD, |
65 | Configuration.HUD, |
|
66 | nameof(Configuration.HUD.EnableWhiteList), |
66 | nameof(Configuration.HUD.EnableWhiteList), |
|
67 | false, |
67 | false, |
|
68 | DataSourceUpdateMode.OnPropertyChanged); |
68 | DataSourceUpdateMode.OnPropertyChanged); |
|
69 | |
69 | |
|
70 | fuzzTrackBar.DataBindings.Add(nameof(fuzzTrackBar.Value), |
70 | fuzzTrackBar.DataBindings.Add(nameof(fuzzTrackBar.Value), |
|
71 | Configuration.Spring, |
71 | Configuration.Spring, |
|
72 | nameof(Configuration.Spring.Fuzz), |
72 | nameof(Configuration.Spring.Fuzz), |
|
73 | false, |
73 | false, |
|
74 | DataSourceUpdateMode.OnPropertyChanged); |
74 | DataSourceUpdateMode.OnPropertyChanged); |
|
75 | |
75 | |
|
76 | textBox2.Text = Configuration.Spring.Fuzz.ToString(); |
76 | textBox2.Text = Configuration.Spring.Fuzz.ToString(); |
|
77 | |
77 | |
|
78 | hudColorLabel.DataBindings.Add(nameof(hudColorLabel.BackColor), |
78 | hudColorLabel.DataBindings.Add(nameof(hudColorLabel.BackColor), |
|
79 | Configuration.HUD, |
79 | Configuration.HUD, |
|
80 | nameof(Configuration.HUD.Color), |
80 | nameof(Configuration.HUD.Color), |
|
81 | false, |
81 | false, |
|
82 | DataSourceUpdateMode.OnPropertyChanged); |
82 | DataSourceUpdateMode.OnPropertyChanged); |
|
83 | |
83 | |
|
84 | enableHudCheckBox.DataBindings.Add(nameof(enableHudCheckBox.Checked), |
84 | enableHudCheckBox.DataBindings.Add(nameof(enableHudCheckBox.Checked), |
|
85 | Configuration.HUD, |
85 | Configuration.HUD, |
|
86 | nameof(Configuration.HUD.Enable), |
86 | nameof(Configuration.HUD.Enable), |
|
87 | false, |
87 | false, |
|
88 | DataSourceUpdateMode.OnPropertyChanged); |
88 | DataSourceUpdateMode.OnPropertyChanged); |
|
89 | |
89 | |
|
90 | enableKeyboardCheckbox.DataBindings.Add(nameof(enableKeyboardCheckbox.Checked), |
90 | enableKeyboardCheckbox.DataBindings.Add(nameof(enableKeyboardCheckbox.Checked), |
|
91 | Configuration.Spring.Charge, |
91 | Configuration.Spring.Charge, |
|
92 | nameof(Configuration.Spring.Charge.Keyboard), |
92 | nameof(Configuration.Spring.Charge.Keyboard), |
|
93 | false, |
93 | false, |
|
94 | DataSourceUpdateMode.OnPropertyChanged); |
94 | DataSourceUpdateMode.OnPropertyChanged); |
|
95 | |
95 | |
|
96 | useRelativeMouseMovementCheckbox.DataBindings.Add(nameof(useRelativeMouseMovementCheckbox.Checked), |
96 | useRelativeMouseMovementCheckbox.DataBindings.Add(nameof(useRelativeMouseMovementCheckbox.Checked), |
|
97 | Configuration.Spring.Discharge, |
97 | Configuration.Spring.Discharge, |
|
98 | nameof(Configuration.Spring.Discharge.UseRelativeMouseMovement), |
98 | nameof(Configuration.Spring.Discharge.UseRelativeMouseMovement), |
|
99 | false, |
99 | false, |
|
100 | DataSourceUpdateMode.OnPropertyChanged); |
100 | DataSourceUpdateMode.OnPropertyChanged); |
|
101 | |
101 | |
|
102 | enableMouseMoveCheckBox.DataBindings.Add(nameof(enableMouseMoveCheckBox.Checked), |
102 | enableMouseMoveCheckBox.DataBindings.Add(nameof(enableMouseMoveCheckBox.Checked), |
|
103 | Configuration.Spring.Charge, |
103 | Configuration.Spring.Charge, |
|
104 | nameof(Configuration.Spring.Charge.MouseMove), |
104 | nameof(Configuration.Spring.Charge.MouseMove), |
|
105 | false, |
105 | false, |
|
106 | DataSourceUpdateMode.OnPropertyChanged); |
106 | DataSourceUpdateMode.OnPropertyChanged); |
|
107 | |
107 | |
|
108 | enableMouseClickCheckBox.DataBindings.Add(nameof(enableMouseClickCheckBox.Checked), |
108 | enableMouseClickCheckBox.DataBindings.Add(nameof(enableMouseClickCheckBox.Checked), |
|
109 | Configuration.Spring.Charge, |
109 | Configuration.Spring.Charge, |
|
110 | nameof(Configuration.Spring.Charge.MouseClick), |
110 | nameof(Configuration.Spring.Charge.MouseClick), |
|
111 | false, |
111 | false, |
|
112 | DataSourceUpdateMode.OnPropertyChanged); |
112 | DataSourceUpdateMode.OnPropertyChanged); |
|
113 | |
113 | |
|
114 | chargeDelayTrackBar.DataBindings.Add(nameof(chargeDelayTrackBar.Value), |
114 | chargeDelayTrackBar.DataBindings.Add(nameof(chargeDelayTrackBar.Value), |
|
115 | Configuration.Spring.Charge, |
115 | Configuration.Spring.Charge, |
|
116 | nameof(Configuration.Spring.Charge.ChargeSeconds), |
116 | nameof(Configuration.Spring.Charge.ChargeSeconds), |
|
117 | false, |
117 | false, |
|
118 | DataSourceUpdateMode.OnPropertyChanged); |
118 | DataSourceUpdateMode.OnPropertyChanged); |
|
119 | |
119 | |
|
120 | textBox3.Text = Configuration.Spring.Charge.ChargeSeconds.ToString(); |
120 | textBox3.Text = Configuration.Spring.Charge.ChargeSeconds.ToString(); |
|
121 | |
121 | |
|
122 | maximumRepeatsTrackBar.DataBindings.Add(nameof(maximumRepeatsTrackBar.Value), |
122 | maximumRepeatsTrackBar.DataBindings.Add(nameof(maximumRepeatsTrackBar.Value), |
|
123 | Configuration.Spring.Charge, |
123 | Configuration.Spring.Charge, |
|
124 | nameof(Configuration.Spring.Charge.MaximumRepeats), |
124 | nameof(Configuration.Spring.Charge.MaximumRepeats), |
|
125 | false, |
125 | false, |
|
126 | DataSourceUpdateMode.OnPropertyChanged); |
126 | DataSourceUpdateMode.OnPropertyChanged); |
|
127 | |
127 | |
|
128 | textBox1.Text = Configuration.Spring.Charge.MaximumRepeats.ToString(); |
128 | textBox1.Text = Configuration.Spring.Charge.MaximumRepeats.ToString(); |
|
129 | } |
129 | } |
|
130 | |
130 | |
|
131 | private SettingsForm() |
131 | private SettingsForm() |
|
132 | { |
132 | { |
|
133 | InitializeComponent(); |
133 | InitializeComponent(); |
|
134 | Utilities.WindowState.FormTracker.Track(this); |
- | ||
135 | |
134 | |
|
136 | PanelGraphics = hudPostionPanel.CreateGraphics(); |
135 | PanelGraphics = hudPostionPanel.CreateGraphics(); |
|
137 | PanelBounds = PanelGraphics.VisibleClipBounds; |
136 | PanelBounds = PanelGraphics.VisibleClipBounds; |
|
138 | PanelSolidColorBrush = new SolidBrush(hudPostionPanel.BackColor); |
137 | PanelSolidColorBrush = new SolidBrush(hudPostionPanel.BackColor); |
|
139 | PanelRegion = new Region(PanelBounds); |
138 | PanelRegion = new Region(PanelBounds); |
|
140 | } |
139 | } |
|
141 | |
140 | |
|
142 | #endregion |
- | ||
143 | |
- | ||
- | 141 | #endregion |
||
- | 142 | |
||
- | 143 | #region Event Handlers |
||
- | 144 | private void SettingsForm_Load(object sender, EventArgs e) |
||
- | 145 | { |
||
144 | #region Event Handlers |
146 | Utilities.WindowState.FormTracker.Track(this); |
|
145 | |
147 | } |
|
146 | private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) |
148 | private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) |
|
147 | { |
149 | { |
|
148 | var listBox = (ListBox) sender; |
150 | var listBox = (ListBox) sender; |
|
149 | var item = listBox.SelectedItem; |
151 | var item = listBox.SelectedItem; |
|
150 | |
152 | |
|
151 | if (item == null) |
153 | if (item == null) |
|
152 | { |
154 | { |
|
153 | return; |
155 | return; |
|
154 | } |
156 | } |
|
155 | |
157 | |
|
156 | whiteListEntryTextBox.Text = item.ToString(); |
158 | whiteListEntryTextBox.Text = item.ToString(); |
|
157 | } |
159 | } |
|
158 | |
160 | |
|
159 | private void Button2_Click(object sender, EventArgs e) |
161 | private void Button2_Click(object sender, EventArgs e) |
|
160 | { |
162 | { |
|
161 | var text = whiteListEntryTextBox.Text; |
163 | var text = whiteListEntryTextBox.Text; |
|
162 | |
164 | |
|
163 | if (string.IsNullOrEmpty(text)) |
165 | if (string.IsNullOrEmpty(text)) |
|
164 | { |
166 | { |
|
165 | return; |
167 | return; |
|
166 | } |
168 | } |
|
167 | |
169 | |
|
168 | try |
170 | try |
|
169 | { |
171 | { |
|
170 | var _ = new Regex(text, RegexOptions.Compiled); |
172 | var _ = new Regex(text, RegexOptions.Compiled); |
|
171 | } |
173 | } |
|
172 | catch |
174 | catch |
|
173 | { |
175 | { |
|
174 | return; |
176 | return; |
|
175 | } |
177 | } |
|
176 | |
178 | |
|
177 | if (!WhitelistBinding.Contains(text)) |
179 | if (!WhitelistBinding.Contains(text)) |
|
178 | { |
180 | { |
|
179 | WhitelistBinding.Add(text); |
181 | WhitelistBinding.Add(text); |
|
180 | } |
182 | } |
|
181 | } |
183 | } |
|
182 | |
184 | |
|
183 | private void Button3_Click(object sender, EventArgs e) |
185 | private void Button3_Click(object sender, EventArgs e) |
|
184 | { |
186 | { |
|
185 | var item = windowWhiteListListBox.SelectedItem; |
187 | var item = windowWhiteListListBox.SelectedItem; |
|
186 | |
188 | |
|
187 | if (item == null) |
189 | if (item == null) |
|
188 | { |
190 | { |
|
189 | return; |
191 | return; |
|
190 | } |
192 | } |
|
191 | |
193 | |
|
192 | var text = item.ToString(); |
194 | var text = item.ToString(); |
|
193 | |
195 | |
|
194 | if (string.IsNullOrEmpty(text)) |
196 | if (string.IsNullOrEmpty(text)) |
|
195 | { |
197 | { |
|
196 | return; |
198 | return; |
|
197 | } |
199 | } |
|
198 | |
200 | |
|
199 | if (WhitelistBinding.Contains(text)) |
201 | if (WhitelistBinding.Contains(text)) |
|
200 | { |
202 | { |
|
201 | WhitelistBinding.Remove(text); |
203 | WhitelistBinding.Remove(text); |
|
202 | } |
204 | } |
|
203 | } |
205 | } |
|
204 | |
206 | |
|
205 | private void Button1_Click(object sender, EventArgs e) |
207 | private void Button1_Click(object sender, EventArgs e) |
|
206 | { |
208 | { |
|
207 | if (colorDialog1.ShowDialog() != DialogResult.OK) |
209 | if (colorDialog1.ShowDialog() != DialogResult.OK) |
|
208 | { |
210 | { |
|
209 | return; |
211 | return; |
|
210 | } |
212 | } |
|
211 | |
213 | |
|
212 | Configuration.HUD.Color = colorDialog1.Color; |
214 | Configuration.HUD.Color = colorDialog1.Color; |
|
213 | hudColorLabel.BackColor = colorDialog1.Color; |
215 | hudColorLabel.BackColor = colorDialog1.Color; |
|
214 | } |
216 | } |
|
215 | |
217 | |
|
216 | private void SpringSettingsForm_Shown(object sender, EventArgs e) |
218 | private void SpringSettingsForm_Shown(object sender, EventArgs e) |
|
217 | { |
219 | { |
|
218 | var x = Configuration.HUD.Position.X * PanelBounds.Width / 100f; |
220 | var x = Configuration.HUD.Position.X * PanelBounds.Width / 100f; |
|
219 | var y = Configuration.HUD.Position.Y * PanelBounds.Height / 100f; |
221 | var y = Configuration.HUD.Position.Y * PanelBounds.Height / 100f; |
|
220 | |
222 | |
|
221 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
223 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
|
222 | |
224 | |
|
223 | PanelGraphics.DrawIcon(Resources.x, |
225 | PanelGraphics.DrawIcon(Resources.x, |
|
224 | (int) (x - Resources.x.Width / 2f), |
226 | (int) (x - Resources.x.Width / 2f), |
|
225 | (int) (y - Resources.x.Height / 2f)); |
227 | (int) (y - Resources.x.Height / 2f)); |
|
226 | } |
228 | } |
|
227 | |
229 | |
|
228 | private void HUDPositionPanel_MouseClick(object sender, MouseEventArgs e) |
230 | private void HUDPositionPanel_MouseClick(object sender, MouseEventArgs e) |
|
229 | { |
231 | { |
|
230 | var x = e.Location.X; |
232 | var x = e.Location.X; |
|
231 | var y = e.Location.Y; |
233 | var y = e.Location.Y; |
|
232 | |
234 | |
|
233 | Configuration.HUD.Position.X = (int) (100f * x / PanelBounds.Width); |
235 | Configuration.HUD.Position.X = (int) (100f * x / PanelBounds.Width); |
|
234 | Configuration.HUD.Position.Y = (int) (100f * y / PanelBounds.Height); |
236 | Configuration.HUD.Position.Y = (int) (100f * y / PanelBounds.Height); |
|
235 | |
237 | |
|
236 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
238 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
|
237 | |
239 | |
|
238 | PanelGraphics.DrawIcon(Resources.x, |
240 | PanelGraphics.DrawIcon(Resources.x, |
|
239 | (int) (x - Resources.x.Width / 2f), |
241 | (int) (x - Resources.x.Width / 2f), |
|
240 | (int) (y - Resources.x.Height / 2f)); |
242 | (int) (y - Resources.x.Height / 2f)); |
|
241 | } |
243 | } |
|
242 | |
244 | |
|
243 | private void HUDColorLabel_Click(object sender, EventArgs e) |
245 | private void HUDColorLabel_Click(object sender, EventArgs e) |
|
244 | { |
246 | { |
|
245 | if (colorDialog1.ShowDialog() != DialogResult.OK) |
247 | if (colorDialog1.ShowDialog() != DialogResult.OK) |
|
246 | { |
248 | { |
|
247 | return; |
249 | return; |
|
248 | } |
250 | } |
|
249 | |
251 | |
|
250 | Configuration.HUD.Color = colorDialog1.Color; |
252 | Configuration.HUD.Color = colorDialog1.Color; |
|
251 | hudColorLabel.BackColor = colorDialog1.Color; |
253 | hudColorLabel.BackColor = colorDialog1.Color; |
|
252 | } |
254 | } |
|
253 | |
255 | |
|
254 | private void TabControl1_SelectedIndexChanged(object sender, EventArgs e) |
256 | private void TabControl1_SelectedIndexChanged(object sender, EventArgs e) |
|
255 | { |
257 | { |
|
256 | var x = Configuration.HUD.Position.X * PanelBounds.Width / 100f; |
258 | var x = Configuration.HUD.Position.X * PanelBounds.Width / 100f; |
|
257 | var y = Configuration.HUD.Position.Y * PanelBounds.Height / 100f; |
259 | var y = Configuration.HUD.Position.Y * PanelBounds.Height / 100f; |
|
258 | |
260 | |
|
259 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
261 | PanelGraphics.FillRegion(PanelSolidColorBrush, PanelRegion); |
|
260 | |
262 | |
|
261 | PanelGraphics.DrawIcon(Resources.x, |
263 | PanelGraphics.DrawIcon(Resources.x, |
|
262 | (int) (x - Resources.x.Width / 2f), |
264 | (int) (x - Resources.x.Width / 2f), |
|
263 | (int) (y - Resources.x.Height / 2f)); |
265 | (int) (y - Resources.x.Height / 2f)); |
|
264 | } |
266 | } |
|
265 | |
267 | |
|
266 | private void FuzzTrackBar_Scroll(object sender, EventArgs e) |
268 | private void FuzzTrackBar_Scroll(object sender, EventArgs e) |
|
267 | { |
269 | { |
|
268 | var trackBar = (TrackBar) sender; |
270 | var trackBar = (TrackBar) sender; |
|
269 | |
271 | |
|
270 | textBox2.Text = trackBar.Value.ToString(); |
272 | textBox2.Text = trackBar.Value.ToString(); |
|
271 | } |
273 | } |
|
272 | |
274 | |
|
273 | private void TextBox2_TextChanged(object sender, EventArgs e) |
275 | private void TextBox2_TextChanged(object sender, EventArgs e) |
|
274 | { |
276 | { |
|
275 | var textBox = (TextBox) sender; |
277 | var textBox = (TextBox) sender; |
|
276 | |
278 | |
|
277 | if (!int.TryParse(textBox.Text, out var value) || |
279 | if (!int.TryParse(textBox.Text, out var value) || |
|
278 | value < fuzzTrackBar.Minimum || |
280 | value < fuzzTrackBar.Minimum || |
|
279 | value > fuzzTrackBar.Maximum) |
281 | value > fuzzTrackBar.Maximum) |
|
280 | { |
282 | { |
|
281 | return; |
283 | return; |
|
282 | } |
284 | } |
|
283 | |
285 | |
|
284 | fuzzTrackBar.Value = value; |
286 | fuzzTrackBar.Value = value; |
|
285 | } |
287 | } |
|
286 | |
288 | |
|
287 | private void MaximumRepeatsTrackBar_Scroll(object sender, EventArgs e) |
289 | private void MaximumRepeatsTrackBar_Scroll(object sender, EventArgs e) |
|
288 | { |
290 | { |
|
289 | var trackBar = (TrackBar) sender; |
291 | var trackBar = (TrackBar) sender; |
|
290 | |
292 | |
|
291 | textBox1.Text = trackBar.Value.ToString(); |
293 | textBox1.Text = trackBar.Value.ToString(); |
|
292 | } |
294 | } |
|
293 | |
295 | |
|
294 | private void TextBox3_TextChanged(object sender, EventArgs e) |
296 | private void TextBox3_TextChanged(object sender, EventArgs e) |
|
295 | { |
297 | { |
|
296 | var textBox = (TextBox) sender; |
298 | var textBox = (TextBox) sender; |
|
297 | |
299 | |
|
298 | if (!int.TryParse(textBox.Text, out var value) || |
300 | if (!int.TryParse(textBox.Text, out var value) || |
|
299 | value < chargeDelayTrackBar.Minimum || |
301 | value < chargeDelayTrackBar.Minimum || |
|
300 | value > chargeDelayTrackBar.Maximum) |
302 | value > chargeDelayTrackBar.Maximum) |
|
301 | { |
303 | { |
|
302 | return; |
304 | return; |
|
303 | } |
305 | } |
|
304 | |
306 | |
|
305 | chargeDelayTrackBar.Value = value; |
307 | chargeDelayTrackBar.Value = value; |
|
306 | } |
308 | } |
|
307 | |
309 | |
|
308 | private void ChargeDelayTrackBar_Scroll(object sender, EventArgs e) |
310 | private void ChargeDelayTrackBar_Scroll(object sender, EventArgs e) |
|
309 | { |
311 | { |
|
310 | var trackBar = (TrackBar) sender; |
312 | var trackBar = (TrackBar) sender; |
|
311 | |
313 | |
|
312 | textBox3.Text = trackBar.Value.ToString(); |
314 | textBox3.Text = trackBar.Value.ToString(); |
|
313 | } |
315 | } |
|
314 | |
316 | |
|
315 | private void TextBox1_TextChanged(object sender, EventArgs e) |
317 | private void TextBox1_TextChanged(object sender, EventArgs e) |
|
316 | { |
318 | { |
|
317 | var textBox = (TextBox) sender; |
319 | var textBox = (TextBox) sender; |
|
318 | |
320 | |
|
319 | if (!int.TryParse(textBox.Text, out var value) || |
321 | if (!int.TryParse(textBox.Text, out var value) || |
|
320 | value < maximumRepeatsTrackBar.Minimum || |
322 | value < maximumRepeatsTrackBar.Minimum || |
|
321 | value > maximumRepeatsTrackBar.Maximum) |
323 | value > maximumRepeatsTrackBar.Maximum) |
|
322 | { |
324 | { |
|
323 | return; |
325 | return; |
|
324 | } |
326 | } |
|
325 | |
327 | |
|
326 | maximumRepeatsTrackBar.Value = value; |
328 | maximumRepeatsTrackBar.Value = value; |
|
327 | } |
329 | } |
|
328 | |
330 | |
|
- | 331 | #endregion |
||
- | 332 | |
||
329 | #endregion |
333 | |
|
330 | } |
334 | } |
|
331 | } |
335 | } |
|
332 | |
336 | |