679
社区成员
发帖
与我相关
我的任务
分享
Private Sub mnuCompile_Click()
'<EhHeader>
On Error GoTo mnuCompile_Click_Err
'</EhHeader>
Dim StartTime As Single
Dim bCompileSucceed As Boolean
If gsProjectPathBase = "" Then
MsgBox IIf(mnuEnglish.Checked, "No project file.Please create a new project or open a project.", "当前没有项目文件。请新建项目或者打开已经存在的项目。"), vbCritical, SOFTWARE_NAME
Exit Sub
End If
If datWaveFile.Recordset.RecordCount = 0 And datMidiFile.Recordset.RecordCount = 0 Then
MsgBox IIf(mnuEnglish.Checked, "Empty project", "空项目。"), vbCritical, SOFTWARE_NAME
Exit Sub
End If
If mnuCompile.Tag = "Overflow" Then
MsgBox "容量溢出,请减小语音文件的大小后重新编译", vbExclamation
Exit Sub
End If
StartTime = Timer
Toolbar1.Buttons("build").Enabled = False
mnuCompile.Enabled = False
frmCompile.mSecondsPassed = 0
frmCompile.lblInfo.Caption = IIf(frmMain.mnuEnglish.Checked, "Compiling, please wait...", "正在编译,请稍候。。。")
frmCompile.lblTimeCost.Caption = IIf(frmMain.mnuEnglish.Checked, "Cost: 0s", "用时:0 秒")
frmCompile.Move Me.Left + (Me.Width - frmCompile.Width) / 2, Me.Top + (Me.Height - frmCompile.Height) / 2
frmCompile.txtBinFileName.Text = gsProjectPathBase & IIf(gChipModel = 5, "_25Pxx", "") & ".bin"
frmCompile.txtBinFileName.SelStart = 0
frmCompile.txtBinFileName.SelLength = Len(frmCompile.txtBinFileName.Text)
frmCompile.cmdCloseMe.Visible = False
frmCompile.cmdCOMDownload.Visible = False
frmCompile.cmdUSBDownload.Visible = False
frmCompile.cmdBrowse.Visible = False
' SetWindowAttributes frmCompile, True
frmCompile.tmrVaryProgressBarValue.Enabled = True
frmCompile.tmrShowSecond.Enabled = True
frmCompile.imgProgressBar.Move 0, frmCompile.ScaleHeight - frmCompile.imgProgressBar.Height, frmCompile.ScaleWidth
frmCompile.imgProgressBarBlock.Top = frmCompile.imgProgressBar.Top + 40
frmCompile.imgProgressBar.Visible = True
frmCompile.imgProgressBarBlock.Visible = True
frmCompile.Show vbModeless
frmCompile.Refresh
DoEvents
gsDataControlMode = CStr(gSystemMode)
gsOPState = CStr(gPwmDac)
gsSleepControl = CStr(gSleepFlag)
gsPort0PullUpControl = CStr(gP0Ph)
frmCompile.imgProgressBarBlock.Left = 75
If gChipModel = 5 Then
bCompileSucceed = Compile25PXX
Else
bCompileSucceed = CompileNormal
End If
Beep
frmCompile.tmrShowSecond.Enabled = False
frmCompile.tmrVaryProgressBarValue.Enabled = False
frmCompile.imgProgressBar.Visible = False
frmCompile.imgProgressBarBlock.Visible = False
If bCompileSucceed Then
frmCompile.lblInfo.Caption = IIf(frmMain.mnuEnglish.Checked, "Compile successful, please select your choice:", "编译完成,请选择您所需要的操作:")
Else
frmCompile.lblInfo.Caption = IIf(frmMain.mnuEnglish.Checked, "Compile failed, please contact us.", "编译失败,请将剪贴板中的信息发送给我们唯创公司。")
frmCompile.txtBinFileName.Text = Clipboard.GetText
End If
frmCompile.lblTimeCost.Caption = IIf(frmMain.mnuEnglish.Checked, "Cost: ", "用时:") & Format$(Timer - StartTime, "#.0") & IIf(frmMain.mnuEnglish.Checked, "s", "秒")
SetWindowAttributes frmCompile, False
Toolbar1.Buttons("build").Enabled = True
mnuCompile.Enabled = True
If bCompileSucceed Then
frmCompile.cmdBrowse.Visible = True
frmCompile.cmdCloseMe.Visible = True
frmCompile.cmdCOMDownload.Visible = True
frmCompile.cmdUSBDownload.Visible = True
If mnuAutoCOMDownloadAfterCompile.Checked Then
frmCompile.cmdCOMDownload_Click
ElseIf mnuAutoUSBDownloadAfterCompile.Checked Then
frmCompile.cmdUSBDownload_Click
Else
frmCompile.cmdCOMDownload.SetFocus
End If
End If
'<EhFooter>
Exit Sub
mnuCompile_Click_Err:
MsgBox Err.Description & vbCrLf & _
"in prjOTP.frmMain.mnuCompile_Click " & _
"at line " & Erl, _
vbExclamation + vbOKOnly, "Application Error"
Resume Next