Language: Add ToBoolean, EMIBenchmark: try blocks

This commit is contained in:
Jonathan Jenne 2020-04-22 14:34:22 +02:00
parent 162485e3f0
commit d2717b9216
2 changed files with 46 additions and 33 deletions

View File

@ -11,6 +11,7 @@ Public Class Form1
Private _Logger As Logger
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
_LogConfig = New LogConfig(LogConfig.PathType.Temp, Nothing, "EDMIBenschmark")
_Logger = _LogConfig.GetLogger()
@ -21,6 +22,9 @@ Public Class Form1
_Channel.Open()
DocumentViewer1.Init(_LogConfig, "21182889975216572111813147150675976632")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
End Try
End Sub
Private Sub AddLogMessage(Message As String)
@ -44,6 +48,7 @@ Public Class Form1
End Sub
Private Async Sub ButtonImportFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonImportFiles.ItemClick
Try
Dim oFiles As New List(Of String)
Dim oSWTotal As New Stopwatch()
oSWTotal.Start()
@ -75,6 +80,9 @@ Public Class Form1
oSWTotal.Stop()
AddLogMessage($"Total Time: {FormatTime(oSWTotal.ElapsedMilliseconds)}")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
End Try
End Sub
Private Sub buttonClearLog_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles buttonClearLog.ItemClick

View File

@ -22,6 +22,11 @@ Public Class Utils
Return [Enum].Parse(GetType(T), value)
End Function
Public Shared Function ToBoolean(input As String) As Boolean
If String.IsNullOrEmpty(input) Then Return False
Return (input.Trim().ToLower() = "true") OrElse (input.Trim() = "1")
End Function
''' <summary>
''' Checks a value for three different `null` values,
''' Nothing, Empty String, DBNull