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
| Public Sub RefreshDataUICars()
IsLoadingUICars = True
'countCarsSelected = 0
If dtCars.Rows.Count <= 0 Then Exit Sub
For Each Row As DataRow In dtCars.Rows
Dim CarName As String = CStr(Row(DicoColsCars(EnumCol.Name).Name))
UpdateCarRow(CarName, Row)
Next
SetUIDataGridViewCars()
IsLoadingUICars = False
End Sub
Private Sub UpdateCarRow(CarName As String, Row As DataRow)
Dim Location As String = Cars1(CarName).CurrentEmplacement.ToString
Row(DicoColsCars(EnumCol.Name).Name) = CarName
Row(DicoColsCars(EnumCol.Type).Name) = If(Cars1(CarName).Original, "Originale", "Mod")
Row(DicoColsCars(EnumCol.Stocké).Name) = If(Cars1(CarName).EnStock, "Oui", "Non")
Row(DicoColsCars(EnumCol.Emplacement).Name) = Location
Row(DicoColsCars(EnumCol.Statut).Name) = If(Cars1(CarName).Activé, "Activé", "Désactivé")
Row(DicoColsCars(EnumCol.NewContent).Name) = If(Cars1(CarName).NewContent, "Oui", "Non")
If Options.CalculFolderSize Then Row(DicoColsCars(EnumCol.Taille).Name) = Cars1(CarName).FolderSize
Row(DicoColsCars(EnumCol.Dépendance).Name) = Cars1(CarName).Dépendance
'Row(dgvCols.Ico.Name) = If(Cars(CarName).Activé, My.Resources.status, My.Resources.status_away)
Row(DicoColsCars(EnumCol.Note).Name) = Cars1(CarName).Note
Row(DicoColsCars(EnumCol.Commentaires).Name) = Cars1(CarName).Commentaire
Row(DicoColsCars(EnumCol.Catégorie).Name) = Cars1(CarName).Catégorie
Row(DicoColsCars(EnumCol.Marque).Name) = Cars1(CarName).Marque
Row(DicoColsCars(EnumCol.Modele).Name) = Cars1(CarName).Modele
Row(DicoColsCars(EnumCol.Classe).Name) = Cars1(CarName).Classe
Row(DicoColsCars(EnumCol.Puissance).Name) = Cars1(CarName).Puissance
Row(DicoColsCars(EnumCol.Couple).Name) = Cars1(CarName).Couple
Row(DicoColsCars(EnumCol.Poids).Name) = Cars1(CarName).Poids
Row(DicoColsCars(EnumCol.Vitesse).Name) = Cars1(CarName).Vitesse
Row(DicoColsCars(EnumCol.Accélération).Name) = Cars1(CarName).Accélération
Row(DicoColsCars(EnumCol.RatioPW).Name) = Cars1(CarName).RatioPW
Row(DicoColsCars(EnumCol.Rang).Name) = Cars1(CarName).Rang ' If(Cars(CarName).Rang.HasValue, CInt(Cars(CarName).Rang), DBNull.Value)
Row(DicoColsCars(EnumCol.Motricité).Name) = Cars1(CarName).Motricité
Row(DicoColsCars(EnumCol.Boite).Name) = Cars1(CarName).Boite
Row(DicoColsCars(EnumCol.User1).Name) = Cars1(CarName).User1
Row(DicoColsCars(EnumCol.Selec).Name) = Cars1(CarName).Selected
End Sub
Private Sub SetUIDataGridViewCars()
If DataGridViewCars.Rows.Count <= 0 Then Exit Sub
For Each Row As DataGridViewRow In DataGridViewCars.Rows
Dim CarName As String = CStr(Row.Cells(DicoColsCars(EnumCol.Name).Name).Value)
SetUIDataGridViewRowCar(CarName, Row)
Next
DataGridViewCars.Refresh()
End Sub
Private Sub SetUIDataGridViewRowCar(CarName As String, Row As DataGridViewRow)
IsLoadingUICars = True
'Dim Location As String = Cars(CarName).CurrentLocation.ToString
Dim Cell As DataGridViewCell = Row.Cells(DicoColsCars(EnumCol.Selec).Name)
Dim chkCell As DataGridViewCheckBoxCell = CType(Cell, DataGridViewCheckBoxCell)
Dim cbCol As DataGridViewComboBoxColumn = CType(DataGridViewCars.Columns(DicoColsCars(EnumCol.Dépendance).Name), DataGridViewComboBoxColumn)
Dim cbCell As DataGridViewComboBoxCell = CType(Row.Cells(DicoColsCars(EnumCol.Dépendance).Name), DataGridViewComboBoxCell)
If Cars1(CarName).Locked Then
chkCell.ReadOnly = True
'chkCell.ThreeState = True
'chkCell.Value = 2
'chkCell.Value = True
chkCell.FlatStyle = FlatStyle.Flat
'chkCell.Style.BackColor = Color.Gray
chkCell.Style.ForeColor = Color.DarkGray
cbCell.ReadOnly = True
Else
Row.DefaultCellStyle.BackColor = Nothing
chkCell.ReadOnly = False
cbCell.ReadOnly = False
End If
If Cars1(CarName).NewContent Then
Row.DefaultCellStyle.ForeColor = Options.ColorNewContent
Row.DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Bold)
Else
Row.DefaultCellStyle.ForeColor = Nothing
Row.DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Regular)
End If
If Cars1(CarName).CurrentEmplacement = Emplacement.ACFolder AndAlso Cars1(CarName).EnStock Then
' Dossier Double
'Location = "Double"
Row.DefaultCellStyle.BackColor = Options.ColorInvalide
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.Désinstallé Then
' Voiture indisponible
Row.DefaultCellStyle.ForeColor = Options.ColorDésinstallé
Row.DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Italic)
ElseIf Cars1(CarName).Original Then
' Voiture originale
Row.DefaultCellStyle.BackColor = Options.ColorOriginal
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.ACFolder AndAlso Not Cars1(CarName).EnStock Then
' Dossier AcFolder
Row.DefaultCellStyle.BackColor = Options.ColorModAcFolder
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.LinkedToACTools AndAlso Not Cars1(CarName).EnStock Then
' Ce cas n'arrive jamais puisque les jonctions orphelines LinkedToACTools sont ignorées au demmarrage
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.LinkedToACTools AndAlso Cars1(CarName).EnStock Then
' Cas normal
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.LinkedToOthers AndAlso Not Cars1(CarName).EnStock Then
' Interdiction de toucher à la jonction Other si le contenu n'est pas en Stock
Row.DefaultCellStyle.BackColor = Options.ColorLinkToOtherLocked
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.LinkedToOthers AndAlso Cars1(CarName).EnStock Then
' Si contenu présent dans ACTools on peux désactiver J-ACMan (En Option)
If Options.EnabledLinkToOther Then
Row.DefaultCellStyle.BackColor = Options.ColorLinkToOtherEnStockEnabled
Else
Row.DefaultCellStyle.BackColor = Options.ColorLinkToOtherEnStockDisabled
End If
Else
' Cas normal
End If
'Row.Cells(dgvCols.Location.Name).Value = Location ' ***************************************************************
Dim Icone As Bitmap
If Cars1(CarName).Invalide Then
Icone = My.Resources.status_busy
ElseIf Cars1(CarName).CurrentEmplacement = Emplacement.Désinstallé Then
Icone = My.Resources.status_away
ElseIf Cars1(CarName).Activé Then
Icone = My.Resources.status
Else
Icone = My.Resources.status_offline
End If
Row.Cells(DicoColsCars(EnumCol.Ico).Name).Value = Icone
Dim Note As Integer = Cars1(CarName).Note
Dim img As Image = Nothing
Select Case Note
Case 1
img = My.Resources.étoile1_64x14_
Case 2
img = My.Resources.étoile2_64x14_
Case 3
img = My.Resources.étoile3_64x14_
Case 4
img = My.Resources.étoile4_64x14_
Case 5
img = My.Resources.étoile5_64x14_
Case Else
img = My.Resources.étoile0_64x14_
End Select
Row.Cells(DicoColsCars(EnumCol.imgNote).Name).Value = img
IsLoadingUICars = False
End Sub |
Partager