-
Notifications
You must be signed in to change notification settings - Fork 37
/
frmBlueprintManagement.vb
2275 lines (1880 loc) · 88.9 KB
/
frmBlueprintManagement.vb
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.Data.SQLite
Imports System.IO
Public Class frmBlueprintManagement
Private cmbBPTypeFilterLoaded As Boolean
Private FirstLoad As Boolean
Private SelectedType As String
Private DataEntered As Boolean
Private TabPressed As Boolean
' Inline grid row update variables
Private CurrentRow As ListViewItem
Private PreviousRow As ListViewItem
Private NextRow As ListViewItem
Private NextCellRow As ListViewItem
Private PreviousCellRow As ListViewItem
Private CurrentCell As ListViewItem.ListViewSubItem
Private PreviousCell As ListViewItem.ListViewSubItem
Private NextCell As ListViewItem.ListViewSubItem
Private MEUpdate As Boolean
Private TEUpdate As Boolean
Private FavoriteUpdate As Boolean
Private OwnedTypeUpdate As Boolean
Private IgnoredBPUpdate As Boolean
Private BPTypeUpdate As Boolean
Private BPColumnClicked As Integer
Private BPColumnSortOrder As SortOrder
Private Const SelectTypeText As String = "Select Type"
Private Structure BlueprintAsset
Dim TypeID As Long
Dim BPType As Integer
End Structure
#Region "ObjectSection"
Private Sub lstBPs_ColumnClick(sender As System.Object, e As System.Windows.Forms.ColumnClickEventArgs) Handles lstBPs.ColumnClick
Call ListViewColumnSorter(e.Column, CType(lstBPs, ListView), BPColumnClicked, BPColumnSortOrder)
End Sub
Private Sub lstBPs_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstBPs.SelectedIndexChanged
If lstBPs.SelectedIndices.Count <> 0 Then
' Put the selected BP ME/TE in the boxes when clicked
txtBPME.Text = lstBPs.SelectedItems(0).SubItems(5).Text
txtBPTE.Text = lstBPs.SelectedItems(0).SubItems(6).Text
End If
End Sub
Private Sub txtBPME_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtBPME.KeyPress
' Only allow numbers or backspace
If e.KeyChar <> ControlChars.Back Then
If allowedMETEChars.IndexOf(e.KeyChar) = -1 Then
' Invalid Character
e.Handled = True
End If
End If
End Sub
Private Sub txtBPPE_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtBPTE.KeyPress
' Only allow numbers or backspace
If e.KeyChar <> ControlChars.Back Then
If allowedMETEChars.IndexOf(e.KeyChar) = -1 Then
' Invalid Character
e.Handled = True
End If
End If
End Sub
Private Sub txtBPME_TextChanged(sender As Object, e As System.EventArgs) Handles txtBPME.TextChanged
Call VerifyMETEEntry(txtBPME, "ME")
End Sub
Private Sub txtBPTE_TextChanged(sender As Object, e As System.EventArgs) Handles txtBPTE.TextChanged
Call VerifyMETEEntry(txtBPTE, "TE")
End Sub
Private Sub btnResetSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResetSearch.Click
txtBPSearch.Text = ""
Call UpdateBlueprintGrid(True)
End Sub
Private Sub rbtnOwned_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnOwned.CheckedChanged
If Not FirstLoad And rbtnOwned.Checked Then
' Disable both scan types
btnScanPersonalBPs.Enabled = False
btnScanCorpBPs.Enabled = False
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnAll_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnAllBPs.CheckedChanged
If Not FirstLoad And rbtnAllBPs.Checked Then
Call SetScanEnableButtons()
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnFavorites_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnFavorites.CheckedChanged
If Not FirstLoad And rbtnFavorites.Checked Then
Call SetScanEnableButtons()
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnIgnored_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnIgnored.CheckedChanged
If Not FirstLoad And rbtnIgnored.Checked Then
Call SetScanEnableButtons()
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnScannedPersonalBPs_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnScannedPersonalBPs.CheckedChanged
' Disable scan button
If rbtnScannedPersonalBPs.Checked Then
btnScanPersonalBPs.Enabled = False
btnScanCorpBPs.Enabled = False
Else
Call SetScanEnableButtons()
End If
If Not FirstLoad And rbtnScannedPersonalBPs.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnScannedCorpBPs_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnScannedCorpBPs.CheckedChanged
' Disable scan button
If rbtnScannedCorpBPs.Checked Then
btnScanPersonalBPs.Enabled = False
btnScanCorpBPs.Enabled = False
Else
Call SetScanEnableButtons()
End If
If Not FirstLoad And rbtnScannedCorpBPs.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(False)
End If
End Sub
Private Sub rbtnMarkasOwned_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnMarkasOwned.CheckedChanged
chkMarkasFavorite.Enabled = True
chkMarkasIgnored.Enabled = True
chkEnableMETE.Enabled = True
If Not chkEnableMETE.Checked Then
Call EnableMETE(False)
Else
Call EnableMETE(True)
End If
End Sub
Private Sub rbtnMarkasUnowned_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnMarkasUnowned.CheckedChanged
chkMarkasFavorite.Enabled = True
chkMarkasIgnored.Enabled = True
If rbtnMarkasUnowned.Checked = True Then
Call EnableMETE(False)
chkEnableMETE.Enabled = False
Else
If Not chkEnableMETE.Checked Then
Call EnableMETE(False)
End If
chkEnableMETE.Enabled = True
End If
End Sub
Private Sub rbtnRemoveAllSettings_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnRemoveAllSettings.CheckedChanged
chkMarkasFavorite.Enabled = False
chkMarkasIgnored.Enabled = False
chkEnableMETE.Enabled = False
Call EnableMETE(False)
End Sub
Private Sub ResetTypeCmbFillGrid()
If Not FirstLoad Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub chkBPT1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPT1.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPT2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPT2.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPT3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPT3.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPStoryline_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPStoryline.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPNavyFaction_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPNavyFaction.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPPirateFaction_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBPPirateFaction.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPSmall_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkBPSmall.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPMedium_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkBPMedium.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPXL_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkBPXL.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkBPLarge_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkBPLarge.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub rbtnShipBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnShipBlueprints.CheckedChanged
If Not FirstLoad And rbtnShipBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnModuleBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnModuleBlueprints.CheckedChanged
If Not FirstLoad And rbtnModuleBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnDroneBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnDroneBlueprints.CheckedChanged
If Not FirstLoad And rbtnDroneBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnAmmoChargeBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnAmmoChargeBlueprints.CheckedChanged
If Not FirstLoad And rbtnAmmoChargeBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnRigBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnRigBlueprints.CheckedChanged
If Not FirstLoad And rbtnRigBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnComponentBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnComponentBlueprints.CheckedChanged
If Not FirstLoad And rbtnComponentBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnSubsystemBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnSubsystemBlueprints.CheckedChanged
If Not FirstLoad And rbtnSubsystemBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnStructureBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnStructureBlueprints.CheckedChanged
If Not FirstLoad And rbtnStructureBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnStructureModulesBlueprints_CheckedChanged(sender As Object, e As EventArgs) Handles rbtnStructureModulesBlueprints.CheckedChanged
If Not FirstLoad And rbtnStructureModulesBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnCelestialBlueprints_CheckedChanged(sender As Object, e As EventArgs) Handles rbtnCelestialsBlueprints.CheckedChanged
If Not FirstLoad And rbtnCelestialsBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnStationPartsBlueprints_CheckedChanged(sender As Object, e As EventArgs) Handles rbtnStructureRigsBlueprints.CheckedChanged
If Not FirstLoad And rbtnStructureRigsBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnDeployableBlueprints_CheckedChanged(sender As Object, e As EventArgs) Handles rbtnDeployableBlueprints.CheckedChanged
If Not FirstLoad And rbtnDeployableBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnReactionBlueprints_CheckedChanged(sender As Object, e As EventArgs) Handles rbtnReactionBlueprints.CheckedChanged
If Not FirstLoad And rbtnReactionBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnAllBPTypes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnAllBPTypes.CheckedChanged
If Not FirstLoad And rbtnAllBPTypes.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnBoosterBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnBoosterBlueprints.CheckedChanged
If Not FirstLoad And rbtnBoosterBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnToolBlueprints_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnMiscBlueprints.CheckedChanged
If Not FirstLoad And rbtnMiscBlueprints.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnBPAllBPtypes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnShowAllBPtypes.CheckedChanged
If Not FirstLoad And rbtnShowAllBPtypes.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnBPOnlyBPO_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnOnlyBPO.CheckedChanged
If Not FirstLoad And rbtnOnlyBPO.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnBPOnlyCopies_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnOnlyCopies.CheckedChanged
If Not FirstLoad And rbtnOnlyCopies.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub rbtnOnlyInventedBPCs_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnOnlyInventedBPCs.CheckedChanged
If Not FirstLoad And rbtnOnlyInventedBPCs.Checked Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub chkNotOwned_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkNotOwned.CheckedChanged
If Not FirstLoad Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub chkNotIgnored_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkNotIgnored.CheckedChanged
If Not FirstLoad Then
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
Call UpdateBlueprintGrid(True)
End If
End Sub
Private Sub chkRaceAmarr_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRaceAmarr.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkRaceCaldari_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRaceCaldari.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkRaceGallente_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRaceGallente.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkRaceMinmatar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRaceMinmatar.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkRacePirate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRacePirate.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub chkRaceOther_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRaceOther.CheckedChanged
Call ResetTypeCmbFillGrid()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
Call UpdateBlueprintGrid(True)
End Sub
Private Sub cmbBPTypeFilter_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbBPTypeFilter.DropDown
If Not cmbBPTypeFilterLoaded And (SelectedType <> cmbBPTypeFilter.Text) Then
Call LoadBPTypes()
cmbBPTypeFilterLoaded = True
End If
End Sub
Private Sub cmbBPTypeFilter_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbBPTypeFilter.SelectedIndexChanged
If SelectedType <> cmbBPTypeFilter.Text And cmbBPTypeFilter.Text <> SelectTypeText Then
Call UpdateBlueprintGrid(True)
SelectedType = cmbBPTypeFilter.Text
cmbBPTypeFilterLoaded = False
End If
End Sub
Private Sub txtBPSearch_GotFocus(sender As Object, e As System.EventArgs) Handles txtBPSearch.GotFocus
If Not FirstLoad Then
Call txtBPSearch.SelectAll()
End If
End Sub
Private Sub txtBPSearch_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtBPSearch.KeyDown
'Call ProcessCutCopyPasteSelect(txtBPSearch, e)
If e.KeyCode = Keys.Enter Then
Call UpdateBlueprintGrid(True)
End If
End Sub
' Calls grid update based on text entered
Private Sub btnBPSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBPSearch.Click
If Trim(txtBPSearch.Text) = "" Then
MsgBox("Must enter a search item", vbExclamation, Me.Text)
txtBPSearch.Focus()
Exit Sub
End If
Call UpdateBlueprintGrid(True)
txtBPSearch.Focus()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Hide()
End Sub
Private Sub chkEnableMETE_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkEnableMETE.CheckedChanged
Call EnableMETE(chkEnableMETE.Checked)
End Sub
Private Sub EnableMETE(Value As Boolean)
' if true it enables, false disables
lblBPME.Enabled = Value
lblBPTE.Enabled = Value
txtBPME.Enabled = Value
txtBPTE.Enabled = Value
End Sub
#End Region
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
FirstLoad = True
DataEntered = False
TabPressed = False
' Add the colums to the list
lstBPs.Columns.Add("", 25, HorizontalAlignment.Center) ' -2 is autosize, but check boxes set to 25
lstBPs.Columns.Add("BPTypeID", 0, HorizontalAlignment.Left) ' Hidden
lstBPs.Columns.Add("Blueprint Group", 260, HorizontalAlignment.Left)
lstBPs.Columns.Add("Blueprint Name", 300, HorizontalAlignment.Left)
lstBPs.Columns.Add("Tech", 52, HorizontalAlignment.Center)
lstBPs.Columns.Add("ME", 40, HorizontalAlignment.Center)
lstBPs.Columns.Add("TE", 40, HorizontalAlignment.Center)
lstBPs.Columns.Add("Owned", 50, HorizontalAlignment.Center)
lstBPs.Columns.Add("BP Type", 78, HorizontalAlignment.Center)
lstBPs.Columns.Add("Fav", 48, HorizontalAlignment.Center)
lstBPs.Columns.Add("Ignored", 48, HorizontalAlignment.Center)
lstBPs.Columns.Add("Runs", 55, HorizontalAlignment.Center)
' lstBPs.Columns.Add("Quantity", 51, HorizontalAlignment.Right) ' This is different than the API value
lstBPs.Columns.Add("Additional Costs", 88, HorizontalAlignment.Right)
lstBPs.Columns.Add("Scanned", 0, HorizontalAlignment.Center) ' Hidden
Call SetScanEnableButtons()
ttBPManage.SetToolTip(btnBackupBPs, "Exports all Blueprint Data to a csv format for all user APIs")
ttBPManage.SetToolTip(btnLoadBPs, "Loads exported Blueprint Data from csv format")
ttBPManage.SetToolTip(rbtnRemoveAllSettings, "Removes all saved blueprint data for selected blueprints")
End Sub
Private Sub SetScanEnableButtons()
' Tool Tip for Scan button
If SelectedCharacter.AssetsAccess = False Then
ttBPManage.SetToolTip(grpScanAssets, "Scanning Assets only available with correct key access")
' Disable
btnScanPersonalBPs.Enabled = False
Else
ttBPManage.SetToolTip(btnScanPersonalBPs, "Assets refresh every 6 Hours")
btnScanPersonalBPs.Enabled = True
End If
If SelectedCharacter.CharacterCorporation.AssetAccess = False Then
ttBPManage.SetToolTip(grpScanAssets, "Scanning Assets only available with correct key access")
' Disable
btnScanCorpBPs.Enabled = False
Else
ttBPManage.SetToolTip(btnScanCorpBPs, "Assets refresh every 6 Hours")
btnScanCorpBPs.Enabled = True
End If
End Sub
Private Sub frmBlueprintManagement_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Application.DoEvents()
If FirstLoad Then
Call InitForm()
End If
FirstLoad = False
End Sub
Private Sub InitForm()
cmbBPTypeFilterLoaded = False
cmbBPTypeFilter.Text = SelectTypeText
FirstLoad = True
' Race Checks
chkRaceAmarr.Checked = True
chkRaceCaldari.Checked = True
chkRaceGallente.Checked = True
chkRaceMinmatar.Checked = True
chkRacePirate.Checked = True
chkRaceOther.Checked = True
' Set the checks
chkBPNavyFaction.Checked = True
chkBPPirateFaction.Checked = True
chkBPStoryline.Checked = True
chkBPT1.Checked = True
chkBPT2.Checked = True
chkBPT3.Checked = True
txtBPME.Text = "0"
txtBPTE.Text = "0"
rbtnAllBPs.Checked = True
rbtnAllBPTypes.Checked = True
rbtnMarkasOwned.Checked = True
rbtnShowAllBPtypes.Checked = True
txtBPSearch.Text = ""
' Start out not checking this incase people accidently hit it
chkEnableMETE.Checked = False
Call EnableMETE(False)
FirstLoad = False
Call UpdateBlueprintGrid(False)
End Sub
' Updates the blueprint grid with a list of bps
Private Sub UpdateBlueprintGrid(ByVal CheckAllItems As Boolean)
Dim SQL As String = ""
Dim SQL1 As String = ""
Dim readerBP As SQLiteDataReader
Dim rsLookup As SQLiteDataReader
Dim ScannedValue As Integer
Dim BPUserID As Long
Dim BPList As ListViewItem
' Get the selection clause from options on screen
SQL = BuildBPSelectQuery()
If SQL = "" Then
' No valid query so just show nothing
lstBPs.Items.Clear()
Exit Sub
End If
' Make sure to set the USER ID for the owned blueprint query
DBCommand = New SQLiteCommand(SQL, EVEDB.DBREf)
If rbtnScannedCorpBPs.Checked Then
' Set the correct ID
BPUserID = SelectedCharacter.CharacterCorporation.CorporationID
Else
BPUserID = GetBPUserID(SelectedCharacter.ID)
End If
DBCommand.Parameters.AddWithValue("@USERBP_USERID", BPUserID) ' need to search for corp ID too
DBCommand.Parameters.AddWithValue("@USERBP_CORPID", CStr(SelectedCharacter.CharacterCorporation.CorporationID))
readerBP = DBCommand.ExecuteReader
lstBPs.Visible = False
Me.Cursor = Cursors.WaitCursor
' Disable buttons till done
gbBPFilter.Enabled = False
gbUpdateOptions.Enabled = False
grpScanAssets.Enabled = False
txtBPEdit.Visible = False
cmbEdit.Visible = False
Me.Refresh()
Application.DoEvents()
lstBPs.Items.Clear()
' Disable sorting because it will crawl after we update if there are too many records
lstBPs.ListViewItemSorter = Nothing
lstBPs.BeginUpdate()
' Add the records
While readerBP.Read
Application.DoEvents()
BPList = New ListViewItem("")
'The remaining columns are subitems
' 0-BP_ID, 1-BLUEPRINT_GROUP, 2-BLUEPRINT_NAME, 3-ITEM_GROUP_ID, 4-ITEM_GROUP, 5-ITEM_CATEGORY_ID,
' 6-ITEM_CATEGORY, 7-ITEM_ID, 8-ITEM_NAME, 9-ME, 10-TE, 11-USERID, 12-ITEM_TYPE, 13-RACE_ID, 14-OWNED, 15-SCANNED
' 16-BP_TYPE, 17-UNIQUE_BP_ITEM_ID, 18-FAVORITE, 19-VOLUME, 20-MARKET_GROUP_ID, 21-ADDITIONAL_COSTS,
' 22-LOCATION_ID, 23-QUANTITY, 24-FLAG_ID, 25-RUNS, 26-IGNORE, 27-TECH_LEVEL
BPList.SubItems.Add(CStr(readerBP.GetInt64(0))) ' BP ID
BPList.SubItems.Add(readerBP.GetString(1)) ' BP Group
BPList.SubItems.Add(readerBP.GetString(2)) ' BP Name
' 1, 2, 14 are T1, T2, T3
' 3 is Storyline
' 15 is Pirate Faction
' 16 is Navy Faction
Select Case readerBP.GetInt32(12)
Case 1
BPList.SubItems.Add("T1")
Case 2
BPList.SubItems.Add("T2")
Case 14
BPList.SubItems.Add("T3")
Case 3
BPList.SubItems.Add("Storyline")
Case 15
BPList.SubItems.Add("Pirate")
Case 16
BPList.SubItems.Add("Navy")
Case Else
BPList.SubItems.Add(Unknown)
End Select
BPList.SubItems.Add(CStr(readerBP.GetDouble(9))) ' ME
BPList.SubItems.Add(CStr(readerBP.GetDouble(10))) ' TE
Call SetOwnedFlagandColors(BPList, CBool(readerBP.GetValue(14))) ' 14 = Owned
' BP Type
BPList.SubItems.Add(GetBPTypeString(readerBP.GetInt32(16)))
If readerBP.GetInt32(18) = 0 Then
BPList.SubItems.Add(No) ' Favorite
Else
BPList.SubItems.Add(Yes) ' Favorite
End If
If readerBP.GetInt32(26) = 0 Then
BPList.SubItems.Add(No) ' Ignored
Else
BPList.SubItems.Add(Yes) ' Ignored
End If
' If they don't own it, look it up, else use the API data
If CInt(readerBP.GetValue(14)) = 0 Then
' Set runs for bpcs, or unlimited for bpo
If (readerBP.GetInt32(16) = BPType.Copy Or readerBP.GetInt32(16) = BPType.InventedBPC Or readerBP.GetInt32(16) = BPType.NotOwned) And readerBP.GetInt32(27) <> 1 Then
' If T2/T3 invented - look up base runs for the bpc assuming no decryptors, else get the value stored
If readerBP.GetInt32(27) = 2 Then
SQL = "SELECT quantity FROM INDUSTRY_ACTIVITY_PRODUCTS WHERE productTypeID = " & CStr(readerBP.GetInt64(0)) & " AND activityID = 8"
Else ' T3
Dim BPIDLookup As Long
BPIDLookup = GetInventItemTypeID(readerBP.GetInt64(0), "Wrecked")
SQL = "SELECT quantity FROM INDUSTRY_ACTIVITY_PRODUCTS WHERE blueprintTypeID = " & CStr(BPIDLookup) & " AND activityID = 8 "
SQL &= "AND productTypeID = " & CStr(readerBP.GetInt64(0))
End If
DBCommand = New SQLiteCommand(SQL, EVEDB.DBREf)
rsLookup = DBCommand.ExecuteReader
If rsLookup.Read Then
BPList.SubItems.Add(CStr(rsLookup.GetInt32(0)))
Else
BPList.SubItems.Add(Unknown)
End If
rsLookup.Close()
rsLookup = Nothing
ElseIf readerBP.GetInt32(16) = BPType.NotOwned Then
' Get max runs from all_blueprints for unowned bps
SQL = "SELECT MAX_PRODUCTION_LIMIT FROM ALL_BLUEPRINTS WHERE BLUEPRINT_ID = " & CStr(readerBP.GetInt64(0))
DBCommand = New SQLiteCommand(SQL, EVEDB.DBREf)
rsLookup = DBCommand.ExecuteReader
If rsLookup.Read Then
BPList.SubItems.Add(CStr(rsLookup.GetInt32(0)))
Else
BPList.SubItems.Add(Unknown)
End If
rsLookup.Close()
rsLookup = Nothing
ElseIf CInt(readerBP.GetValue(16)) = BPType.Original Then
' BPO's are unlimited runs
BPList.SubItems.Add(Unlimited)
End If
Else ' Get from API store for T1 BPCs
If readerBP.GetInt32(25) = -1 Then
BPList.SubItems.Add(Unlimited)
Else
BPList.SubItems.Add(CStr(readerBP.GetInt32(25)))
End If
End If
' For now, quantity is 1 until I can do multi-bp processing where we would group common ME/TE Bps
'BPList.SubItems.Add("1")
BPList.SubItems.Add(FormatNumber(readerBP.GetDouble(21), 2)) ' Additional Costs
ScannedValue = readerBP.GetInt32(15)
If ScannedValue = 0 Then
BPList.BackColor = Color.White
Else
If SelectedCharacter.ID = readerBP.GetInt32(11) Or readerBP.GetInt32(11) = CommonLoadBPsID Then
BPList.BackColor = Color.BlanchedAlmond
Else ' must be corp
BPList.BackColor = Color.LightGreen
End If
End If
BPList.SubItems.Add(CStr(If(readerBP.IsDBNull(15), 0, readerBP.GetInt32(15)))) ' Scanned
If CheckAllItems Then
BPList.Checked = True
Else
BPList.Checked = False
End If
Call lstBPs.Items.Add(BPList)
End While
' Now sort this
Dim TempType As SortOrder
If BPColumnSortOrder = SortOrder.Ascending Then
TempType = SortOrder.Descending
Else
TempType = SortOrder.Ascending
End If
Call ListViewColumnSorter(BPColumnClicked, CType(lstBPs, ListView), BPColumnClicked, TempType)
lstBPs.EndUpdate()
If CheckAllItems Then
btnSelectAll.Text = "Uncheck All"
Else
btnSelectAll.Text = "Select All"
End If
readerBP.Close()
readerBP = Nothing
DBCommand = Nothing
lstBPs.Visible = True
Me.Cursor = Cursors.Default
gbBPFilter.Enabled = True
gbUpdateOptions.Enabled = True
grpScanAssets.Enabled = True
SelectedType = "" ' Reset this on each load
Application.DoEvents()
Exit Sub
End Sub
' Sets the referenced list view owned colors and back color
Private Sub SetOwnedFlagandColors(ByRef ListSubitem As ListViewItem, ByVal OwnedBP As Boolean)
If OwnedBP Then ' 14 = Owned
ListSubitem.SubItems.Add(Yes)
ListSubitem.ForeColor = Color.Blue
Else
ListSubitem.SubItems.Add(No)
ListSubitem.ForeColor = Color.Black
ListSubitem.BackColor = Color.White
End If
End Sub
' Builds the query for the select list
Private Function BuildBPSelectQuery() As String
Dim SQL As String = ""
Dim ScannedAdd As String = ""
Dim WhereClause As String = ""
Dim RaceClause As String = ""
Dim TempRace As String = ""
Dim SQLItemType As String = ""
Dim TextClause As String = ""
Dim ComboType As String = ""
Dim Copies As String = ""
Dim SizesClause As String = ""
' Base query
SQL = "SELECT * FROM " & USER_BLUEPRINTS
' Find what type of blueprint we want
With Me
WhereClause = GetBlueprintSQLWhereQuery(.rbtnAmmoChargeBlueprints.Checked, .rbtnDroneBlueprints.Checked, .rbtnModuleBlueprints.Checked, .rbtnShipBlueprints.Checked,
.rbtnSubsystemBlueprints.Checked, .rbtnBoosterBlueprints.Checked, .rbtnComponentBlueprints.Checked, .rbtnMiscBlueprints.Checked,
.rbtnDeployableBlueprints.Checked, .rbtnCelestialsBlueprints.Checked, .rbtnStructureBlueprints.Checked, .rbtnStructureRigsBlueprints.Checked,
.rbtnStructureModulesBlueprints.Checked, .rbtnReactionBlueprints.Checked, .rbtnRigBlueprints.Checked)
If WhereClause <> "" Then
WhereClause = "WHERE " & WhereClause
End If
End With
Dim TempClause As String = ""
If rbtnOwned.Checked Then
' Ignore scanned BP's
TempClause = "OWNED <> 0 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
ElseIf rbtnScannedPersonalBPs.Checked Then
Dim CharID As Long = 0
If UserApplicationSettings.LoadBPsbyChar Then
' Use the ID sent
CharID = SelectedCharacter.ID
Else
CharID = CommonLoadBPsID
End If
TempClause = "USER_ID = " & CharID & " AND SCANNED <> 0 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
ElseIf rbtnScannedCorpBPs.Checked Then
' Include corp scanned
TempClause = "USER_ID =" & SelectedCharacter.CharacterCorporation.CorporationID & " AND SCANNED <> 0 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= " AND " & TempClause
End If
ElseIf rbtnFavorites.Checked Then
' Favorites for the user
TempClause = "FAVORITE = 1 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
ElseIf rbtnIgnored.Checked Then
' All ignored
TempClause = "IGNORE = 1 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
End If
' Add not owned if checked
If chkNotOwned.Checked Then
TempClause = "OWNED = 0 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
End If
' Add not Ignored if checked
If chkNotIgnored.Checked Then
TempClause = "IGNORE = 0 "
If WhereClause = "" Then
WhereClause = "WHERE " & TempClause
Else
WhereClause &= "AND " & TempClause
End If
End If
' Item Type Definitions - These are set by me based on existing data
' 1, 2, 14 are T1, T2, T3
' 3 is Storyline
' 15 is Pirate Faction
' 16 is Navy Faction
' Check Tech version
If chkBPT1.Enabled Then
' Only a Subsystem so T3
If chkBPT1.Checked Then
SQLItemType = SQLItemType & "1,"
End If
End If
If chkBPT2.Enabled Then
If chkBPT2.Checked Then
SQLItemType = SQLItemType & "2,"
End If
End If
If chkBPT3.Enabled Then
If chkBPT3.Checked Then
SQLItemType = SQLItemType & "14,"
End If
End If
If chkBPStoryline.Enabled Then
If chkBPStoryline.Checked Then
SQLItemType = SQLItemType & "3,"
End If
End If
If chkBPPirateFaction.Enabled Then
If chkBPPirateFaction.Checked Then
SQLItemType = SQLItemType & "15,"
End If
End If
If chkBPNavyFaction.Enabled Then
If chkBPNavyFaction.Checked Then
SQLItemType = SQLItemType & "16,"
End If
End If
' Add Item Type
If SQLItemType <> "" Then
SQLItemType = "ITEM_TYPE IN (" & SQLItemType.Substring(0, SQLItemType.Length - 1) & ") "