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
| Imports System.Data
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Class MainWindow
' Instanciation of the DataSet + all TableAdapters
Dim DataSet As New FFXIMDCwpf2.DataSet
Dim TAM As FFXIMDCwpf2.DataSetTableAdapters.TableAdapterManager
' Creation of BindingCollectionViews (supporting INotifyCollectionChanged et CustomFilter interfaces) which will serve as ItemsSource to Comboboxs.
' Notice: since can't directly GetDefaultView(Datatable) to build those BindingCollectionViews,
' have to initialize each BindingCollectionView beforehand with its own DataView, so each view can be filtered independently.
Dim MainJobBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.JobsList)), BindingListCollectionView)
Dim SubJobBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.JobsList)), BindingListCollectionView)
Dim MainWeapon1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Weapon)), BindingListCollectionView)
Dim SubWeapon1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Weapon)), BindingListCollectionView)
Dim MainWeapon2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Weapon)), BindingListCollectionView)
Dim SubWeapon2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Weapon)), BindingListCollectionView)
Dim RangedWeaponBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ranged)), BindingListCollectionView)
Dim Ammo1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ammo)), BindingListCollectionView)
Dim Ammo2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ammo)), BindingListCollectionView)
Dim HeadBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Head)), BindingListCollectionView)
Dim NeckBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Neck)), BindingListCollectionView)
Dim LeftEarTP1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ear)), BindingListCollectionView)
Dim LeftEarTP2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ear)), BindingListCollectionView)
Dim RightEarTP1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ear)), BindingListCollectionView)
Dim RightEarTP2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ear)), BindingListCollectionView)
Dim BodyBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Body)), BindingListCollectionView)
Dim HandsBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Hands)), BindingListCollectionView)
Dim LeftRingTP1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ring)), BindingListCollectionView)
Dim LeftRingTP2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ring)), BindingListCollectionView)
Dim RightRingTP1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ring)), BindingListCollectionView)
Dim RightRingTP2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Ring)), BindingListCollectionView)
Dim BackBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Back)), BindingListCollectionView)
Dim WaistBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Waist)), BindingListCollectionView)
Dim LegsBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Legs)), BindingListCollectionView)
Dim FeetBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Feet)), BindingListCollectionView)
Dim WS1BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.WStable)), BindingListCollectionView)
Dim WS2BindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.WStable)), BindingListCollectionView)
Dim JABindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.JobAbilities)), BindingListCollectionView)
Dim MobsFamiliesBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.MobData)), BindingListCollectionView)
Dim MobsBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.Enemies)), BindingListCollectionView)
Dim BLUspellsBindingList As BindingListCollectionView = CType(CollectionViewSource.GetDefaultView(New DataView(DataSet.BLUspells)), BindingListCollectionView)
Dim AreasBindingList As New ObservableCollection(Of String)
'Variable to avoid intempestive calls to the Filtering Procedure(not show here) after loading of the window.
Private IsReady As Boolean = False
Private Sub MainWindow_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
'Apply changes into the Access Databases
TAM.UpdateAll(DataSet)
End Sub
Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles MyBase.Loaded
'Load data into JobsList.
TAM.JobsListTableAdapter.Fill(DataSet.JobsList)
'Load data into table Food.
TAM.FoodTableAdapter.Fill(DataSet.Food)
'Load data into table Buffs.
TAM.BuffsTableAdapter.Fill(DataSet.Buffs)
'Load data into table Weapon.
TAM.WeaponTableAdapter.Fill(DataSet.Weapon)
'Load data into table Ranged.
TAM.RangedTableAdapter.Fill(DataSet.Ranged)
'Load data into table Ammo.
TAM.AmmoTableAdapter.Fill(DataSet.Ammo)
'Load data into table Head.
TAM.HeadTableAdapter.Fill(DataSet.Head)
'Load data into table Neck.
TAM.NeckTableAdapter.Fill(DataSet.Neck)
'Load data into table Ear.
TAM.EarTableAdapter.Fill(DataSet.Ear)
'Load data into table Body.
TAM.BodyTableAdapter.Fill(DataSet.Body)
'Load data into table Hands.
TAM.HandsTableAdapter.Fill(DataSet.Hands)
'Load data into table Ring.
TAM.RingTableAdapter.Fill(DataSet.Ring)
'Load data into table Back.
TAM.BackTableAdapter.Fill(DataSet.Back)
'Load data into table Waist.
TAM.WaistTableAdapter.Fill(DataSet.Waist)
'Load data into table Legs.
TAM.LegsTableAdapter.Fill(DataSet.Legs)
'Load data into table Feet.
TAM.FeetTableAdapter.Fill(DataSet.Feet)
'Load data into table WeaponSkills.
TAM.WStableTableAdapter.Fill(DataSet.WStable)
'Load data into table JobAilities.
TAM.JobAbilitiesTableAdapter.Fill(DataSet.JobAbilities)
'Load data into table Monsters Families/Races.
TAM.MobDataTableAdapter.Fill(DataSet.MobData)
'Load data into table Monsters.
TAM.EnemiesTableAdapter.Fill(DataSet.Enemies)
'Load data into table Skills.
TAM.SkillsTableAdapter.Fill(DataSet.Skills)
'Load data into table Stat and Skill Grades.
TAM.Job_StatSkill_GradesTableAdapter.Fill(DataSet.Job_StatSkill_Grades)
'Load data into table Skill caps by level.
TAM.Skill_CapsTableAdapter.Fill(DataSet.Skill_Caps)
'Load data into table BLU Spells.
TAM.BLUspellsTableAdapter.Fill(DataSet.BLUspells)
'Load data into table Areas.
TAM.AreasTableAdapter.Fill(DataSet.Areas)
' Build of "Description" Column for each equipment DataTables.
' Each field of this column contains a String concatenating all non-null DataRowCell,
' and will be used as dynamic content for a ToolTip on each ComboBoxItems and SelectedItems.
BuildDescriptors()
'Sets DataContexts for all ComboBoxs on the interface.
MainJob.DataContext = MainJobBindingList
SubJob.DataContext = SubJobBindingList
MainJob.SelectedValue = "BLM"
SubJob.SelectedValue = ""
Food1.DataContext = DataSet.Food
Food2.DataContext = DataSet.Food
Buffs1.DataContext = DataSet.Buffs
Buffs2.DataContext = DataSet.Buffs
MainWeapon1.DataContext = MainWeapon1BindingList
SubWeapon1.DataContext = SubWeapon1BindingList
MainWeapon2.DataContext = MainWeapon2BindingList
SubWeapon2.DataContext = SubWeapon2BindingList
RangedWeapon1.DataContext = RangedWeaponBindingList
RangedWeapon2.DataContext = RangedWeaponBindingList
AmmoTP1.DataContext = Ammo1BindingList
AmmoTP2.DataContext = Ammo2BindingList
HeadTP1.DataContext = HeadBindingList
HeadTP2.DataContext = HeadBindingList
NeckTP1.DataContext = NeckBindingList
NeckTP2.DataContext = NeckBindingList
LeftEarTP1.DataContext = LeftEarTP1BindingList
LeftEarTP2.DataContext = LeftEarTP2BindingList
RightEarTP1.DataContext = RightEarTP1BindingList
RightEarTP2.DataContext = RightEarTP2BindingList
BodyTP1.DataContext = BodyBindingList
BodyTP2.DataContext = BodyBindingList
HandsTP1.DataContext = HandsBindingList
HandsTP2.DataContext = HandsBindingList
LeftRingTP1.DataContext = LeftRingTP1BindingList
LeftRingTP2.DataContext = LeftRingTP2BindingList
RightRingTP1.DataContext = RightRingTP1BindingList
RightRingTP2.DataContext = RightRingTP2BindingList
BackTP1.DataContext = BackBindingList
BackTP2.DataContext = BackBindingList
WaistTP1.DataContext = WaistBindingList
WaistTP2.DataContext = WaistBindingList
LegsTP1.DataContext = LegsBindingList
LegsTP2.DataContext = LegsBindingList
FeetTP1.DataContext = FeetBindingList
FeetTP2.DataContext = FeetBindingList
WS1.DataContext = WS1BindingList
WS2.DataContext = WS2BindingList
JAs1.DataContext = JABindingList
JAs2.DataContext = JABindingList
IsReady = True
End Sub |
Partager