📄 surface.vb
字号:
#If CONFIG <> "Debug" Then
Catch ex As Exception
MsgBox(ex)
ProgressBar1_Change(0, "")
Button_Analyze.Enabled = True
Button_Apply.Enabled = True
End Try
#End If
End Sub
Private Sub Button_Apply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Apply.Click
#If CONFIG <> "Debug" Then
Try
#End If
Button_Analyze.Enabled = False
Button_Apply.Enabled = False
If FileCopy Is Nothing Then Throw New InvalidOperationException("没有进行可行性分析")
FileCopy.Apply(SeparateLines(TextBox_PostCopy.Text), TextBox_Result.Text, AddressOf ProgressBar1_Change)
ProgressBar1_Change(1)
Delay(0.5)
ProgressBar1_Change(0, "")
Button_Analyze.Enabled = True
Button_Apply.Enabled = True
#If CONFIG <> "Debug" Then
Catch ex As Exception
MsgBox(ex)
ProgressBar1_Change(0, "")
Button_Analyze.Enabled = True
Button_Apply.Enabled = True
End Try
#End If
End Sub
Private Sub ProgressBar1_Change(ByVal Value As Double, Optional ByVal Status As String = Nothing)
ProgressBar1.Value = Value * 100
If Status IsNot Nothing Then Label_ProgressBarStatus.Text = Status
Application.DoEvents()
End Sub
#Region " 选择文件夹或文件对话框 "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With TextBox_SourceDir
Static d As Windows.Forms.FolderBrowserDialog
If d Is Nothing Then d = New Windows.Forms.FolderBrowserDialog
Dim dir As String = GetFileDirectory(.Text).TrimEnd("\")
If IO.Directory.Exists(dir) Then
d.SelectedPath = dir
End If
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.SelectedPath
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
With TextBox_TargetDir
Static d As Windows.Forms.FolderBrowserDialog
If d Is Nothing Then d = New Windows.Forms.FolderBrowserDialog
Dim dir As String = GetFileDirectory(.Text).TrimEnd("\")
If IO.Directory.Exists(dir) Then
d.SelectedPath = dir
End If
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.SelectedPath
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
With TextBox_NewDir
Static d As Windows.Forms.FolderBrowserDialog
If d Is Nothing Then d = New Windows.Forms.FolderBrowserDialog
Dim dir As String = GetFileDirectory(.Text).TrimEnd("\")
If IO.Directory.Exists(dir) Then
d.SelectedPath = dir
End If
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.SelectedPath
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
With TextBox_BackupDir
Static d As Windows.Forms.FolderBrowserDialog
If d Is Nothing Then d = New Windows.Forms.FolderBrowserDialog
Dim dir As String = GetFileDirectory(.Text).TrimEnd("\")
If IO.Directory.Exists(dir) Then
d.SelectedPath = dir
End If
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.SelectedPath
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
With TextBox_ExceptionalDir
Static d As Windows.Forms.FolderBrowserDialog
If d Is Nothing Then d = New Windows.Forms.FolderBrowserDialog
Dim dir As String = GetFileDirectory(.Text).TrimEnd("\")
If IO.Directory.Exists(dir) Then
d.SelectedPath = dir
End If
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.SelectedPath
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
With TextBox_LogPath
Static d As Windows.Forms.SaveFileDialog
If d Is Nothing Then d = New Windows.Forms.SaveFileDialog
Dim dir As String = GetFileDirectory(.Text)
If IO.Directory.Exists(dir) Then
d.FileName = .Text
End If
d.CheckFileExists = False
d.Filter = "*.txt|*.txt"
If d.ShowDialog() = Windows.Forms.DialogResult.OK Then
.Text = d.FileName
End If
End With
My.Computer.FileSystem.CurrentDirectory = Application.StartupPath
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton_DifferentFileHandling_Backup.CheckedChanged
If RadioButton_DifferentFileHandling_Backup.Checked Then
TextBox_NewDir.Enabled = False
Button3.Enabled = False
TextBox_BackupDir.Enabled = True
Button4.Enabled = True
TextBox_ExceptionalDir.Enabled = True
Button5.Enabled = True
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton_DifferentFileHandling_CopyNew.CheckedChanged
If RadioButton_DifferentFileHandling_CopyNew.Checked Then
TextBox_NewDir.Enabled = True
Button3.Enabled = True
TextBox_BackupDir.Enabled = False
Button4.Enabled = False
TextBox_ExceptionalDir.Enabled = False
Button5.Enabled = False
End If
End Sub
#End Region
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -