Files
Desktop_BLVStudio/BLV_Studio/VersionHistory.vb
2025-12-11 10:06:44 +08:00

217 lines
6.8 KiB
VB.net
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Imports System.ComponentModel
Public Class VersionHistory
''' <summary>
''' 列名
''' </summary>
Public ColumnName As New Dictionary(Of String, String
Public DataList As New List(Of Dictionary(Of String, String))
Public RowData As Dictionary(Of String, String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ColumnName.Add("ID", "ID")
ColumnName.Add("XML_FileName", "文件名")
ColumnName.Add("Version", "版本")
ColumnName.Add("UploadDateTime", "上传时间")
ColumnName.Add("Author", "作者")
ColumnName.Add("Remark", "备注")
ColumnName.Add("ConfigApp_Ver", "软件版本")
FillTable()
End Sub
Public Sub HVTabInit()
HVTab.Cols = 7
HVTab.DisplayRowNumber = True
HVTab.Rows = 1
HVTab.SelectionBorderColor = Color.Red
HVTab.Width = 900
'HVTab.HScrollbarVisible = False
For i As Integer = 0 To ColumnName.Count - 1
With HVTab.Cell(0, i)
.Text = ColumnName.Values(i)
.BackColor = Color.LightGray
.ForeColor = Color.Blue
.Font = New Font($"Arial", 9, FontStyle.Bold)
End With
With HVTab.Column(i)
If ColumnName.Keys(i).Equals("ID") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 30
.Locked = True
ElseIf ColumnName.Keys(i).Equals("XML_FileName") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 300
.Locked = True
ElseIf ColumnName.Keys(i).Equals("Version") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 30
.Locked = True
ElseIf ColumnName.Keys(i).Equals("UploadDateTime") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 100
.Locked = True
ElseIf ColumnName.Keys(i).Equals("Author") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 70
.Locked = True
ElseIf ColumnName.Keys(i).Equals("Remark") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 270
.Locked = True
ElseIf ColumnName.Keys(i).Equals("ConfigApp_Ver") Then
.Alignment = FlexCell.AlignmentEnum.LeftGeneral
.Width = 80
.Locked = True
End If
End With
Next
'HVTab.EnableVisualStyles = True
HVTab.SelectionMode = FlexCell.SelectionModeEnum.ByRow
End Sub
'Private Sub HVTab_ButtonClick(Sender As Object, e As FlexCell.Grid.ButtonClickEventArgs) Handles HVTab.ButtonClick
' If e.Col = ColumnName.Count - 2 Then
' If Not IsNothing(DataList) AndAlso DataList.Count > 0 Then
' RaiseEvent DownloadFile(DataList.Item(e.Row - 1))
' End If
' ElseIf e.Col = ColumnName.Count - 1 Then
' If Not IsNothing(DataList) AndAlso DataList.Count > 0 Then
' Me.Enabled = False
' RaiseEvent IssueFile(DataList.Item(e.Row - 1))
' End If
' End If
'End Sub
''' <summary>
''' 填充表
''' </summary>
Public Sub FillTable()
HVTabInit()
For i As Integer = 0 To DataList.Count - 1
With HVTab.Row(i)
.Height = 20
End With
Dim dic As Dictionary(Of String, String) = DataList.Item(i)
HVTab.AddItem("")
For j As Integer = 1 To ColumnName.Count - 1
Dim text As String = dic.Item(ColumnName.Keys(j))
' HVTab.Cell(i + 1, j).WrapText = True
HVTab.Cell(i + 1, j).Text = text
HVTab.Cell(i + 1, j).Locked = True
Next
Next
End Sub
Public Event DownloadFile(ftpflag As Dictionary(Of String, String))
Public Event IssueFile(ftpflag As Dictionary(Of String, String))
Public Event OnOpenFile(ftpflag As Dictionary(Of String, String))
Private Sub HVTab_Click(Sender As Object, e As EventArgs) Handles HVTab.Click
If HVTab.ActiveCell.Row > 0 Then
xml_lab.Text = HVTab.Cell(HVTab.ActiveCell.Row, 1).DisplayText
Label1.Text = HVTab.Cell(HVTab.ActiveCell.Row, 5).DisplayText
'Label1.Font = xml_lab.Font
' Dim CellStr As String = $"选中个格{HVTab.ActiveCell.Row},{ HVTab.ActiveCell.Col}{ HVTab.Cell(HVTab.ActiveCell.Row, HVTab.ActiveCell.Col).Text}"
' Dim RowStr As String = $"选中行({HVTab.ActiveCell.Row})"
' For j As Integer = 0 To ColumnName.Count - 1
' If j = 0 Then
' RowStr = RowStr & $"{j} : {HVTab.ActiveCell.Row} " & vbCrLf
' Else
' RowStr = RowStr & $"{j} : {HVTab.Cell(HVTab.ActiveCell.Row, j).DisplayText } " & vbCrLf
' End If
' Next
' LabelX1.Text = RowStr & vbCrLf & CellStr
End If
End Sub
Private Sub OpenFile_Click(sender As Object, e As EventArgs)
If HVTab.ActiveCell.Row > 0 Then
If Not IsNothing(DataList) AndAlso DataList.Count > 0 Then
RaiseEvent OnOpenFile(DataList.Item(HVTab.ActiveCell.Row - 1))
End If
Else
MsgBox"未选中文件"
End If
End Sub
Private Sub VersionHistory_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
End Sub
Private Sub VersionHistory_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
Dim dic As New Dictionary(Of String, String)
RaiseEvent DownloadFile(dic)
End Sub
Private Sub DownFile_btn_Click_1(sender As Object, e As EventArgs) Handles DownFile_btn.Click
BtnSevenClick(DialogResult.OK)
End Sub
Private Sub ReleaseFile_Click_1(sender As Object, e As EventArgs) Handles ReleaseFile.Click
BtnSevenClick(DialogResult.Abort)
End Sub
Private Sub OpenFile_Click_1(sender As Object, e As EventArgs) Handles OpenFile.Click
BtnSevenClick(DialogResult.Yes)
End Sub
Public sub BtnSevenClick(bunber As DialogResult )
RowData =Nothing
If HVTab.ActiveCell.Row > 0 Then
If Not IsNothing(DataList) AndAlso DataList.Count > 0 Then
RowData = DataList.Item(HVTab.ActiveCell.Row - 1)
Me.DialogResult = bunber
End If
Else
MsgBox"未选中文件"
End If
End sub
End Class