47 lines
1.3 KiB
VB.net
47 lines
1.3 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 _Logger As Logger
|
|
|
|
Public Sub New()
|
|
InitializeComponent()
|
|
|
|
_Logger = My.LogConfig.GetLogger()
|
|
End Sub
|
|
|
|
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 |