-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFormTreeSearchOptions.vb
More file actions
485 lines (404 loc) · 17.1 KB
/
FormTreeSearchOptions.vb
File metadata and controls
485 lines (404 loc) · 17.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
Option Strict On
Imports Microsoft.WindowsAPICodePack.Dialogs
Public Class FormTreeSearchOptions
Private FMain As Form_Main
Private _LibraryDirectory As String
Public Property LibraryDirectory As String
Get
Return _LibraryDirectory
End Get
Set(value As String)
_LibraryDirectory = value
If Me.TableLayoutPanel1 IsNot Nothing Then
LabelLibraryDirectory.Text = FMain.TruncateDirectoryName(value, Me.Width)
End If
End Set
End Property
Private _TemplateDirectory As String
Public Property TemplateDirectory As String
Get
Return _TemplateDirectory
End Get
Set(value As String)
_TemplateDirectory = value
If Me.TableLayoutPanel1 IsNot Nothing Then
LabelTemplateDirectory.Text = FMain.TruncateDirectoryName(value, Me.Width)
End If
End Set
End Property
Private _DataDirectory As String
Public Property DataDirectory As String
Get
Return _DataDirectory
End Get
Set(value As String)
_DataDirectory = value
If Me.TableLayoutPanel1 IsNot Nothing Then
LabelDataDirectory.Text = FMain.TruncateDirectoryName(value, Me.Width)
End If
End Set
End Property
Private _MaterialTable As String
Public Property MaterialTable As String
Get
Return _MaterialTable
End Get
Set(value As String)
_MaterialTable = value
If Me.TableLayoutPanel1 IsNot Nothing Then
LabelMaterialLibrary.Text = FMain.TruncateDirectoryName(value, Me.Width)
End If
End Set
End Property
Private _AlwaysReadExcel As Boolean
Public Property AlwaysReadExcel As Boolean
Get
Return _AlwaysReadExcel
End Get
Set(value As Boolean)
_AlwaysReadExcel = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxAlwaysReadExcel.Checked = value
End If
End Set
End Property
'Private _AutoPattern As Boolean
'Public Property AutoPattern As Boolean
' Get
' Return _AutoPattern
' End Get
' Set(value As Boolean)
' _AutoPattern = value
' If Me.TableLayoutPanel1 IsNot Nothing Then
' CheckBoxAutoPattern.Checked = value
' End If
' End Set
'End Property
Private _AddProp As Boolean
Public Property AddProp As Boolean
Get
Return _AddProp
End Get
Set(value As Boolean)
_AddProp = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxAddProp.Checked = value
End If
End Set
End Property
Private _DisableFineThreadWarning As Boolean
Public Property DisableFineThreadWarning As Boolean
Get
Return _DisableFineThreadWarning
End Get
Set(value As Boolean)
_DisableFineThreadWarning = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxDisableFineThreadWarning.Checked = value
End If
End Set
End Property
Private _ProcessTemplateInBackground As Boolean
Public Property ProcessTemplateInBackground As Boolean
Get
Return _ProcessTemplateInBackground
End Get
Set(value As Boolean)
_ProcessTemplateInBackground = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxProcessTemplateInBackground.Checked = ProcessTemplateInBackground
End If
End Set
End Property
Private _FailedConstraintSuppress As Boolean
Public Property FailedConstraintSuppress As Boolean
Get
Return _FailedConstraintSuppress
End Get
Set(value As Boolean)
_FailedConstraintSuppress = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxFailedConstraintSuppress.Checked = FailedConstraintSuppress
End If
End Set
End Property
Private _FailedConstraintAllow As Boolean
Public Property FailedConstraintAllow As Boolean
Get
Return _FailedConstraintAllow
End Get
Set(value As Boolean)
_FailedConstraintAllow = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxFailedConstraintAllow.Checked = FailedConstraintAllow
End If
End Set
End Property
Private _SuspendMRU As Boolean
Public Property SuspendMRU As Boolean
Get
Return _SuspendMRU
End Get
Set(value As Boolean)
_SuspendMRU = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxSuspendMRU.Checked = SuspendMRU
End If
End Set
End Property
'Private _AllowCommaDelimiters As Boolean
'Public Property AllowCommaDelimiters As Boolean
' Get
' Return _AllowCommaDelimiters
' End Get
' Set(value As Boolean)
' _AllowCommaDelimiters = value
' If Me.TableLayoutPanel1 IsNot Nothing Then
' CheckBoxAllowCommaDelimiters.Checked = AllowCommaDelimiters
' End If
' End Set
'End Property
'Private _AlwaysOnTop As Boolean
'Public Property AlwaysOnTop As Boolean
' Get
' Return _AlwaysOnTop
' End Get
' Set(value As Boolean)
' _AlwaysOnTop = value
' If Me.TableLayoutPanel1 IsNot Nothing Then
' CheckBoxAlwaysOnTop.Checked = value
' End If
' End Set
'End Property
Private _IncludeDrawing As Boolean
Public Property IncludeDrawing As Boolean
Get
Return _IncludeDrawing
End Get
Set(value As Boolean)
_IncludeDrawing = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxIncludeDrawing.Checked = value
End If
End Set
End Property
Private _AlwaysOnTopRefreshTime As String
Public Property AlwaysOnTopRefreshTime As String
Get
Return _AlwaysOnTopRefreshTime
End Get
Set(value As String)
_AlwaysOnTopRefreshTime = value
If Me.TextBoxAlwaysOnTopRefreshTime IsNot Nothing Then
If Not TextBoxAlwaysOnTopRefreshTime.Text = _AlwaysOnTopRefreshTime Then
TextBoxAlwaysOnTopRefreshTime.Text = _AlwaysOnTopRefreshTime
End If
End If
End Set
End Property
Private _PartPlacementTimeout As String
Public Property PartPlacementTimeout As String
Get
Return _PartPlacementTimeout
End Get
Set(value As String)
_PartPlacementTimeout = value
If Me.TextBoxPartPlacementTimeout IsNot Nothing Then
If Not TextBoxPartPlacementTimeout.Text = _PartPlacementTimeout Then
TextBoxPartPlacementTimeout.Text = _PartPlacementTimeout
End If
End If
End Set
End Property
Private _CheckNewVersion As Boolean
Public Property CheckNewVersion As Boolean
Get
Return _CheckNewVersion
End Get
Set(value As Boolean)
_CheckNewVersion = value
If Me.TableLayoutPanel1 IsNot Nothing Then
CheckBoxCheckNewVersion.Checked = value
End If
End Set
End Property
Public Sub New(_FMain As Form_Main)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.FMain = _FMain
End Sub
Private Sub FormOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Not FMain.LibraryDirectory = "" Then
Me.LibraryDirectory = Me.FMain.LibraryDirectory
Else
Me.LibraryDirectory = "Select a directory to store your standard parts"
End If
If Not FMain.DataDirectory = "" Then
Me.DataDirectory = Me.FMain.DataDirectory
Else
Me.DataDirectory = "Select a directory with your data files"
End If
If Not FMain.TemplateDirectory = "" Then
Me.TemplateDirectory = Me.FMain.TemplateDirectory
Else
Me.TemplateDirectory = "Select a directory with your standard part templates"
End If
If Not FMain.MaterialTable = "" Then
Me.MaterialTable = Me.FMain.MaterialTable
Else
Me.MaterialTable = "Select a material table"
End If
Me.AlwaysReadExcel = FMain.AlwaysReadExcel
Me.AddProp = FMain.AddProp
Me.DisableFineThreadWarning = FMain.DisableFineThreadWarning
Me.ProcessTemplateInBackground = FMain.ProcessTemplateInBackground
Me.FailedConstraintSuppress = FMain.FailedConstraintSuppress
Me.FailedConstraintAllow = FMain.FailedConstraintAllow
Me.SuspendMRU = FMain.SuspendMRU
Me.IncludeDrawing = FMain.IncludeDrawing
Me.AlwaysOnTopRefreshTime = FMain.AlwaysOnTopRefreshTime
Me.PartPlacementTimeout = FMain.PartPlacementTimeout
Me.CheckNewVersion = FMain.CheckNewVersion
End Sub
Private Sub ButtonLibraryDirectory_Click(sender As Object, e As EventArgs) Handles ButtonLibraryDirectory.Click
Dim tmpFolderDialog As New CommonOpenFileDialog
tmpFolderDialog.IsFolderPicker = True
Dim UP As New UtilsPreferences
tmpFolderDialog.InitialDirectory = UP.GetPreferencesDirectory
If tmpFolderDialog.ShowDialog() = DialogResult.OK Then
Me.LibraryDirectory = tmpFolderDialog.FileName
End If
End Sub
Private Sub ButtonTemplateDirectory_Click(sender As Object, e As EventArgs) Handles ButtonTemplateDirectory.Click
Dim tmpFolderDialog As New CommonOpenFileDialog
tmpFolderDialog.IsFolderPicker = True
Dim UP As New UtilsPreferences
Dim PreferencesDirectory = UP.GetPreferencesDirectory
If IO.Directory.Exists(PreferencesDirectory) Then
tmpFolderDialog.InitialDirectory = PreferencesDirectory
End If
If tmpFolderDialog.ShowDialog() = DialogResult.OK Then
Me.TemplateDirectory = tmpFolderDialog.FileName
End If
End Sub
Private Sub ButtonDataDirectory_Click(sender As Object, e As EventArgs) Handles ButtonDataDirectory.Click
Dim tmpFolderDialog As New CommonOpenFileDialog
tmpFolderDialog.IsFolderPicker = True
Dim UP As New UtilsPreferences
Dim PreferencesDirectory = UP.GetPreferencesDirectory
If IO.Directory.Exists(PreferencesDirectory) Then
tmpFolderDialog.InitialDirectory = PreferencesDirectory
End If
If tmpFolderDialog.ShowDialog() = DialogResult.OK Then
Me.DataDirectory = tmpFolderDialog.FileName
End If
End Sub
Private Sub ButtonMaterialLibrary_Click(sender As Object, e As EventArgs) Handles ButtonMaterialLibrary.Click
Dim tmpFileDialog As New OpenFileDialog
tmpFileDialog.Title = "Select a material library"
tmpFileDialog.Filter = "Material Library files|*.mtl"
Dim MaterialTableDirectory As String = IO.Path.GetDirectoryName(Me.MaterialTable)
If IO.Directory.Exists(MaterialTableDirectory) Then
tmpFileDialog.InitialDirectory = MaterialTableDirectory
End If
If tmpFileDialog.ShowDialog() = DialogResult.OK Then
Me.MaterialTable = tmpFileDialog.FileName
End If
End Sub
Private Sub ButtonOK_Click(sender As Object, e As EventArgs) Handles ButtonOK.Click
If Me.TemplateDirectory(Me.TemplateDirectory.Count - 1) = "\" Then
Me.TemplateDirectory = Me.TemplateDirectory.Substring(0, Me.TemplateDirectory.Count - 1)
End If
Dim PreviousDataDirectory As String = FMain.DataDirectory
Dim PreviousTemplateDirectory As String = FMain.TemplateDirectory
Me.FMain.LibraryDirectory = Me.LibraryDirectory
Me.FMain.DataDirectory = Me.DataDirectory
Me.FMain.TemplateDirectory = Me.TemplateDirectory
FMain.MaterialTable = Me.MaterialTable
FMain.AlwaysReadExcel = Me.AlwaysReadExcel
FMain.AddProp = Me.AddProp
FMain.DisableFineThreadWarning = Me.DisableFineThreadWarning
FMain.ProcessTemplateInBackground = Me.ProcessTemplateInBackground
FMain.FailedConstraintSuppress = Me.FailedConstraintSuppress
FMain.FailedConstraintAllow = Me.FailedConstraintAllow
FMain.SuspendMRU = Me.SuspendMRU
FMain.IncludeDrawing = Me.IncludeDrawing
Dim tmpRefreshTime As Integer = 0
Try
tmpRefreshTime = CInt(Me.AlwaysOnTopRefreshTime)
If tmpRefreshTime < 100 Then tmpRefreshTime = 100
Me.AlwaysOnTopRefreshTime = CStr(tmpRefreshTime)
Catch ex As Exception
Me.AlwaysOnTopRefreshTime = "1000"
End Try
FMain.AlwaysOnTopRefreshTime = Me.AlwaysOnTopRefreshTime
Dim tmpPartPlacementTimeoutTime As Integer = 0
Try
tmpPartPlacementTimeoutTime = CInt(Me.PartPlacementTimeout)
If tmpPartPlacementTimeoutTime < 3000 Then tmpPartPlacementTimeoutTime = 3000
Me.PartPlacementTimeout = CStr(tmpPartPlacementTimeoutTime)
Catch ex As Exception
Me.PartPlacementTimeout = "30000"
End Try
FMain.PartPlacementTimeout = Me.PartPlacementTimeout
FMain.CheckNewVersion = Me.CheckNewVersion
If Not PreviousDataDirectory = Me.DataDirectory Then
FMain.ReloadXml()
End If
Me.DialogResult = DialogResult.OK
End Sub
Private Sub ButtonCancel_Click(sender As Object, e As EventArgs) Handles ButtonCancel.Click
Me.DialogResult = DialogResult.Cancel
End Sub
Private Sub CheckBoxAddProp_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxAddProp.CheckedChanged
Me.AddProp = CheckBoxAddProp.Checked
End Sub
Private Sub CheckBoxDisableFineThreadWarning_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxDisableFineThreadWarning.CheckedChanged
Me.DisableFineThreadWarning = CheckBoxDisableFineThreadWarning.Checked
End Sub
Private Sub CheckBoxCheckNewVersion_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxCheckNewVersion.CheckedChanged
Me.CheckNewVersion = CheckBoxCheckNewVersion.Checked
End Sub
Private Sub CheckBoxAlwaysReadExcel_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxAlwaysReadExcel.CheckedChanged
Me.AlwaysReadExcel = CheckBoxAlwaysReadExcel.Checked
End Sub
Private Sub CheckBoxAutoPattern_CheckedChanged(sender As Object, e As EventArgs)
'Me.AutoPattern = CheckBoxAutoPattern.Checked
End Sub
Private Sub ButtonHelp_Click(sender As Object, e As EventArgs) Handles ButtonHelp.Click
Dim Info = New ProcessStartInfo()
Info.FileName = "https://github.com/rmcanany/SolidEdgeStorekeeper#tree-search"
Info.UseShellExecute = True
System.Diagnostics.Process.Start(Info)
End Sub
Private Sub CheckBoxProcessTemplateInBackground_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxProcessTemplateInBackground.CheckedChanged
Me.ProcessTemplateInBackground = CheckBoxProcessTemplateInBackground.Checked
End Sub
Private Sub CheckBoxFailedConstraintSuppress_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxFailedConstraintSuppress.CheckedChanged
Me.FailedConstraintSuppress = CheckBoxFailedConstraintSuppress.Checked
Me.FailedConstraintAllow = Not Me.FailedConstraintSuppress
End Sub
Private Sub CheckBoxFailedConstraintAllow_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxFailedConstraintAllow.CheckedChanged
Me.FailedConstraintAllow = CheckBoxFailedConstraintAllow.Checked
Me.FailedConstraintSuppress = Not Me.FailedConstraintAllow
End Sub
Private Sub CheckBoxSuspendMRU_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxSuspendMRU.CheckedChanged
Me.SuspendMRU = CheckBoxSuspendMRU.Checked
End Sub
'Private Sub CheckBoxAllowCommaDelimiters_CheckedChanged(sender As Object, e As EventArgs)
' AllowCommaDelimiters = CheckBoxAllowCommaDelimiters.Checked
'End Sub
Private Sub CheckBoxAlwaysOnTop_CheckedChanged(sender As Object, e As EventArgs)
'Me.AlwaysOnTop = CheckBoxAlwaysOnTop.Checked
End Sub
Private Sub CheckBoxIncludeDrawing_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxIncludeDrawing.CheckedChanged
Me.IncludeDrawing = CheckBoxIncludeDrawing.Checked
End Sub
Private Sub TextBoxAlwaysOnTopRefreshTime_TextChanged(sender As Object, e As EventArgs) Handles TextBoxAlwaysOnTopRefreshTime.TextChanged
Me.AlwaysOnTopRefreshTime = TextBoxAlwaysOnTopRefreshTime.Text
End Sub
Private Sub TextBoxPartPlacementTimeout_TextChanged(sender As Object, e As EventArgs) Handles TextBoxPartPlacementTimeout.TextChanged
Me.PartPlacementTimeout = TextBoxPartPlacementTimeout.Text
End Sub
End Class