274 lines
10 KiB
VB.net
274 lines
10 KiB
VB.net
|
|
Public Class ReleaseControl_frn
|
|||
|
|
|
|||
|
|
Public tmpMsgBox As String = ""
|
|||
|
|
|
|||
|
|
Public notegBox As String = ""
|
|||
|
|
|
|||
|
|
Public Firmware_txt As String = ""
|
|||
|
|
Public ComboBox1_txt As String = ""
|
|||
|
|
|
|||
|
|
Public FirmwareList As List(Of Dictionary(Of String, String))
|
|||
|
|
Public devmodefirmware As Dictionary(Of String, String)
|
|||
|
|
Private Firmwarefilename As New Dictionary(Of String, String())
|
|||
|
|
|
|||
|
|
Private Firmwarefilenamev4 As New Dictionary(Of String, String())
|
|||
|
|
|
|||
|
|
Public FromDic As New Dictionary(Of String, String())
|
|||
|
|
Public ServiceNumber As Integer
|
|||
|
|
|
|||
|
|
Private Function Ischeckdevmodefirmware(filename As String) As Boolean
|
|||
|
|
If IsNothing(devmodefirmware) OrElse devmodefirmware.Count = 0 Then
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
If devmodefirmware.ContainsKey(filename) Then
|
|||
|
|
Return True
|
|||
|
|
Else
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Private Sub ReleaseControl_frn_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|||
|
|
Firmware_box.Items.Clear()
|
|||
|
|
ComboBox1.Items.Clear()
|
|||
|
|
Firmwarefilenamev4.Clear()
|
|||
|
|
Firmwarefilename.Clear()
|
|||
|
|
Dim cbo As ComboBox
|
|||
|
|
Dim ndic As Dictionary(Of String, String())
|
|||
|
|
Dim ver As Integer = 0
|
|||
|
|
If Not IsNothing(FirmwareList) AndAlso FirmwareList.Count > 0 Then
|
|||
|
|
'Firmwarefilename=New Dictionary(Of string,string)
|
|||
|
|
For Each dic In FirmwareList
|
|||
|
|
'Firmwarefilename.Add (dic.Item("FileName"),dic.Item("MD5Val"))
|
|||
|
|
|
|||
|
|
Dim buff(4) As String
|
|||
|
|
buff(0) = dic.Item("AppType")
|
|||
|
|
buff(1) = dic.Item("FileName")
|
|||
|
|
buff(2) = dic.Item("MD5Val")
|
|||
|
|
buff(3) = dic.Item("Remark")
|
|||
|
|
|
|||
|
|
If dic.Item("Luncher_Ver").Equals("C1_L2") Then
|
|||
|
|
If ServiceNumber = 64 Then
|
|||
|
|
Integer.TryParse(dic.Item("Ver"), ver)
|
|||
|
|
If ver > 41 Then
|
|||
|
|
Firmware_box.Items.Add(dic.Item("FileName"))
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Else
|
|||
|
|
Firmware_box.Items.Add(dic.Item("FileName"))
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
If Firmwarefilename.ContainsKey(dic.Item("FileName")) Then
|
|||
|
|
Firmwarefilename.Item(dic.Item("FileName")) = buff
|
|||
|
|
Else
|
|||
|
|
Firmwarefilename.Add(dic.Item("FileName"), buff)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If Firmware_txt.Equals(dic.Item("FileName")) Then
|
|||
|
|
Firmware_box.Text = dic.Item("FileName")
|
|||
|
|
Firmware_box.SelectedItem = dic.Item("FileName")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
ElseIf dic.Item("Luncher_Ver").Equals("C1_L4") Then
|
|||
|
|
|
|||
|
|
|
|||
|
|
If ServiceNumber = 64 Then
|
|||
|
|
Integer.TryParse(dic.Item("Ver"), ver)
|
|||
|
|
If ver > 41 Then
|
|||
|
|
ComboBox1.Items.Add(dic.Item("FileName"))
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Else
|
|||
|
|
ComboBox1.Items.Add(dic.Item("FileName"))
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
If Firmwarefilenamev4.ContainsKey(dic.Item("FileName")) Then
|
|||
|
|
Firmwarefilenamev4.Item(dic.Item("FileName")) = buff
|
|||
|
|
Else
|
|||
|
|
Firmwarefilenamev4.Add(dic.Item("FileName"), buff)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If ComboBox1_txt.Equals(dic.Item("FileName")) Then
|
|||
|
|
ComboBox1.Text = dic.Item("FileName")
|
|||
|
|
ComboBox1.SelectedItem = dic.Item("FileName")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Next
|
|||
|
|
Else
|
|||
|
|
MsgBox($"无可用固件!请联系工程师")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
UpdateVersion_lab.Text = tmpMsgBox
|
|||
|
|
ReleaseNotes_txt.Text = notegBox
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Event ReleaseControlData(ReleasePassword As String, ReleaseNote As String, Firmwarefilename As Dictionary(Of String, String))
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub Confirm_btn_Click(sender As Object, e As EventArgs) Handles Confirm_btn.Click
|
|||
|
|
'ReleasePassword_txt
|
|||
|
|
FromDic.Clear()
|
|||
|
|
If IsNothing(Firmwarefilename) OrElse Firmwarefilename.Count = 0 Then
|
|||
|
|
MsgBox($"未选择固件")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
If String.IsNullOrEmpty(ReleaseNotes_txt.Text) Then
|
|||
|
|
MsgBox($"未输入发布备注")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
If String.IsNullOrEmpty(ReleasePassword_txt.Text) Then
|
|||
|
|
MsgBox($"未输入发布密码")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If CheckBox2.Checked Then
|
|||
|
|
If IsNothing(Firmwarefilename) OrElse Firmwarefilename.Count = 0 Then
|
|||
|
|
MsgBox($"未选择LV2固件")
|
|||
|
|
Return
|
|||
|
|
Else
|
|||
|
|
If Firmwarefilename.ContainsKey(Firmware_box.Text) Then
|
|||
|
|
Dim sbuf As String() = Firmware_box.Text.Trim.Split("_")
|
|||
|
|
Dim bt As Integer = 0
|
|||
|
|
Integer.TryParse(sbuf(1), bt)
|
|||
|
|
|
|||
|
|
If ServiceNumber = 64 AndAlso bt < 42 Then
|
|||
|
|
MsgBox($"本主机配置需要使用的固件版本必须大于41!")
|
|||
|
|
Return
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
FromDic.Add("App_Cfg_For_L2", Firmwarefilename.Item(Firmware_box.Text))
|
|||
|
|
Else
|
|||
|
|
MsgBox($"LV2固件数据丢失")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
'If Not Ischeckdevmodefirmware(FromDic.Item("App_Cfg_For_L2")(1)) Then
|
|||
|
|
' If MsgBox($"{FromDic.Item("App_Cfg_For_L2")(1)}{vbCrLf}该固件不适配所配置的主机和设备,强行发布将导致部分功能失效。{vbCrLf}是否强行发布? ", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
|
|||
|
|
' Else
|
|||
|
|
' Return
|
|||
|
|
' End If
|
|||
|
|
'End If
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If CheckBox4.Checked Then
|
|||
|
|
If IsNothing(Firmwarefilenamev4) OrElse Firmwarefilenamev4.Count = 0 Then
|
|||
|
|
MsgBox($"未选择LV4固件")
|
|||
|
|
Return
|
|||
|
|
Else
|
|||
|
|
If Firmwarefilenamev4.ContainsKey(ComboBox1.Text) Then
|
|||
|
|
Dim sbuf As String() = ComboBox1.Text.Trim.Split("_")
|
|||
|
|
Dim bt As Integer = 0
|
|||
|
|
Integer.TryParse(sbuf(3), bt)
|
|||
|
|
|
|||
|
|
If ServiceNumber = 64 AndAlso bt < 42 Then
|
|||
|
|
MsgBox($"本主机配置需要使用的固件版本必须大于41!")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
FromDic.Add("App_Cfg_For_L4", Firmwarefilenamev4.Item(ComboBox1.Text))
|
|||
|
|
Else
|
|||
|
|
MsgBox($"LV4固件数据丢失")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
'If Not Ischeckdevmodefirmware(FromDic.Item("App_Cfg_For_L4")(1)) Then
|
|||
|
|
' If MsgBox($"{FromDic.Item("App_Cfg_For_L4")(1)}{vbCrLf}该固件不适配所配置的主机和设备,强行发布将导致部分功能失效。{vbCrLf}是否强行发布? ", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
|
|||
|
|
' Else
|
|||
|
|
' Return
|
|||
|
|
' End If
|
|||
|
|
'End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
if CheckBox4.Checked OrElse CheckBox2.Checked Then
|
|||
|
|
Else
|
|||
|
|
MsgBox($"未勾选固件文件!")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
Me.DialogResult = System.Windows.Forms.DialogResult.OK
|
|||
|
|
Me.Close()
|
|||
|
|
Return
|
|||
|
|
'RaiseEvent ReleaseControlData(ReleasePassword_txt.Text, ReleaseNotes_txt.Text, Firmwarefilename)
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Cancel_btn_Click(sender As Object, e As EventArgs) Handles Cancel_btn.Click
|
|||
|
|
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
|
|||
|
|
Me.Close()
|
|||
|
|
'RaiseEvent ReleaseControlData("", "")
|
|||
|
|
'Me.Hide()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub Firmware_box_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles Firmware_box.SelectionChangeCommitted
|
|||
|
|
If Firmwarefilename.ContainsKey(Firmware_box.SelectedItem.ToString) Then
|
|||
|
|
TextBox1.Text = Firmwarefilename.Item(Firmware_box.SelectedItem.ToString)(3)
|
|||
|
|
End If
|
|||
|
|
'TextBox1.Text = Firmwarefilename.Item(Firmware_box.SelectedItem.ToString)(3)
|
|||
|
|
'If IsNothing(FirmwareList) OrElse FirmwareList.Count = 0 Then Return
|
|||
|
|
'If Firmwarefilename.ContainsKey (Firmware_box.Text) Then
|
|||
|
|
' FromDic .Add ("App_Cfg_For_L2",Firmwarefilename.Item (Firmware_box.Text))
|
|||
|
|
'End If
|
|||
|
|
'For Each fiemware In FirmwareList
|
|||
|
|
' If fiemware.Item("FileName").Equals(Firmware_box.Text) Then
|
|||
|
|
' Firmwarefilename.Clear()
|
|||
|
|
' Firmwarefilename = fiemware
|
|||
|
|
' TextBox1.Text = fiemware.Item("Remark")
|
|||
|
|
' End If
|
|||
|
|
'Next
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub ComboBox1_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles ComboBox1.SelectionChangeCommitted
|
|||
|
|
If Firmwarefilenamev4.ContainsKey(ComboBox1.SelectedItem.ToString) Then
|
|||
|
|
TextBox2.Text = Firmwarefilenamev4.Item(ComboBox1.SelectedItem.ToString)(3)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
'TextBox2.Text = Firmwarefilenamev4.Item(ComboBox1.SelectedItem.ToString)(3)
|
|||
|
|
'If IsNothing(FirmwareList) OrElse FirmwareList.Count = 0 Then Return
|
|||
|
|
'For Each fiemware In FirmwareList
|
|||
|
|
' If fiemware.Item("FileName").Equals(ComboBox1.Text) Then
|
|||
|
|
' Firmwarefilenamev4.Clear()
|
|||
|
|
' Firmwarefilenamev4 = fiemware
|
|||
|
|
' TextBox2.Text = fiemware.Item("Remark")
|
|||
|
|
' End If
|
|||
|
|
'Next
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
|
|||
|
|
If Firmwarefilenamev4.ContainsKey(ComboBox1.SelectedItem.ToString) Then
|
|||
|
|
TextBox2.Text = Firmwarefilenamev4.Item(ComboBox1.SelectedItem.ToString)(3)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Firmware_box_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Firmware_box.SelectedIndexChanged
|
|||
|
|
If Firmwarefilename.ContainsKey(Firmware_box.SelectedItem.ToString) Then
|
|||
|
|
TextBox1.Text = Firmwarefilename.Item(Firmware_box.SelectedItem.ToString)(3)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Sub SetHiddenControl()
|
|||
|
|
' ReleaseNotes_txt.Visible = False
|
|||
|
|
UpdateVersion_lab.Visible = False
|
|||
|
|
Label1.Visible = False
|
|||
|
|
notegBox = $"{Now.ToString("yyyy-MM-dd HH:mm:ss")}{vbCrLf }更新配置固件"
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
End Class
|