Modules/EDMI_ClientSuite/frmFileTest.vb
2019-03-04 17:13:49 +01:00

40 lines
1.1 KiB
VB.net

Imports System.IO
Imports DigitalData.Modules.EDMIFileOps
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Logging
Public Class frmFileTest
Private _fileOp As Document
Private Sub frmFileTest_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
_fileOp = New Document(My.LogConfig, My.Settings.EDM_NetworkService_Adress)
Catch ex As Exception
_Logger.Warn($"Unexpected error in frmFileTest_Load: {ex.Message}")
End Try
End Sub
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oDialog = New OpenFileDialog()
Dim oResult = oDialog.ShowDialog()
If oResult <> DialogResult.OK Then
Exit Sub
End If
Try
Dim oDocObject = Await _fileOp.ImportFileAsync(oDialog.FileName)
If oDocObject.OK = False Then
MsgBox(oDocObject.ErrorMessage)
Exit Sub
End If
ListBox1.Items.Add(oDocObject)
Catch ex As Exception
MsgBox(ex.Message)
_Logger.Error(ex)
End Try
End Sub
End Class