diff --git a/Controls.DocumentViewer/DocumentViewer.vb b/Controls.DocumentViewer/DocumentViewer.vb
index 297d9903..85ea3400 100644
--- a/Controls.DocumentViewer/DocumentViewer.vb
+++ b/Controls.DocumentViewer/DocumentViewer.vb
@@ -48,6 +48,11 @@ Public Class DocumentViewer
UpdateMainUi()
End Sub
+ '''
+ ''' Initialize the Viewer
+ '''
+ ''' A LogConfig object
+ ''' The GDPicture.NET License Key
Public Sub Init(LogConfig As LogConfig, LicenseKey As String)
_logConfig = LogConfig
_logger = LogConfig.GetLogger()
@@ -56,6 +61,18 @@ Public Class DocumentViewer
_licenseManager.RegisterKEY(_licenseKey)
End Sub
+ '''
+ ''' Terminate Viewer, freeing up resources and deleting temp files
+ '''
+ Public Sub Done()
+ DeleteTempFiles()
+ Dispose()
+ End Sub
+
+ '''
+ ''' Load a file and display it
+ '''
+ '''
Public Sub LoadFile(filepath As String)
If _licenseKey = String.Empty Then
_logger.Warn("License key was not provided. File {0} not loaded.", filepath)
@@ -74,7 +91,20 @@ Public Class DocumentViewer
UpdateMainUi()
End Sub
- Public Sub DoLoadFile(FilePath As String)
+
+
+ Public Sub DeleteTempFiles()
+ For Each oFile In _TempFiles
+ Try
+ IO.File.Delete(oFile)
+ Catch ex As Exception
+ _logger.Warn("Could not delete temp file {0}", oFile)
+ End Try
+ Next
+ _TempFiles.Clear()
+ End Sub
+
+ Private Sub DoLoadFile(FilePath As String)
Try
Dim oFileInfo = New IO.FileInfo(FilePath)
Dim oExtension As String = oFileInfo.Extension
@@ -497,12 +527,6 @@ Public Class DocumentViewer
End Sub
Private Sub DocumentViewer_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
- For Each oFile In _TempFiles
- Try
- IO.File.Delete(oFile)
- Catch ex As Exception
- _logger.Warn("Could not delete temp file {0}", oFile)
- End Try
- Next
+ GdViewer.Dispose()
End Sub
End Class
diff --git a/GUIs.Test.DocumentViewerTest/App.config b/GUIs.Test.DocumentViewerTest/App.config
index 5534e287..5e0d90e6 100644
--- a/GUIs.Test.DocumentViewerTest/App.config
+++ b/GUIs.Test.DocumentViewerTest/App.config
@@ -1,6 +1,14 @@
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUIs.Test.DocumentViewerTest/Form1.Designer.vb b/GUIs.Test.DocumentViewerTest/Form1.Designer.vb
index 58f6fa40..d4f299fe 100644
--- a/GUIs.Test.DocumentViewerTest/Form1.Designer.vb
+++ b/GUIs.Test.DocumentViewerTest/Form1.Designer.vb
@@ -22,21 +22,12 @@ Partial Class Form1
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
_
Private Sub InitializeComponent()
- Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
- 'DocumentViewer1
- '
- Me.DocumentViewer1.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.DocumentViewer1.Location = New System.Drawing.Point(0, 66)
- Me.DocumentViewer1.Name = "DocumentViewer1"
- Me.DocumentViewer1.Size = New System.Drawing.Size(800, 384)
- Me.DocumentViewer1.TabIndex = 0
- '
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(12, 12)
@@ -74,15 +65,12 @@ Partial Class Form1
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
- Me.Controls.Add(Me.DocumentViewer1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
-
- Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer
Friend WithEvents TextBox1 As TextBox
Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Button1 As Button
diff --git a/GUIs.Test.DocumentViewerTest/Form1.vb b/GUIs.Test.DocumentViewerTest/Form1.vb
index 4e6176a2..ce77568f 100644
--- a/GUIs.Test.DocumentViewerTest/Form1.vb
+++ b/GUIs.Test.DocumentViewerTest/Form1.vb
@@ -1,6 +1,8 @@
Imports DigitalData.Modules.Logging
Public Class Form1
+ Private oSubform As Form2
+
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oResult = OpenFileDialog1.ShowDialog()
@@ -10,7 +12,8 @@ Public Class Form1
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
- DocumentViewer1.LoadFile(TextBox1.Text)
+ oSubform.FilePath = TextBox1.Text
+ oSubform.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message)
End Try
@@ -19,6 +22,12 @@ Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oKey = "0467389434974657969312056"
Dim oLogConfig As New LogConfig(LogConfig.PathType.CurrentDirectory)
- DocumentViewer1.Init(oLogConfig, oKey)
+ oSubform = New Form2(oLogConfig, oKey)
End Sub
+
+ Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
+
+ End Sub
+
+
End Class
diff --git a/GUIs.Test.DocumentViewerTest/Form2.Designer.vb b/GUIs.Test.DocumentViewerTest/Form2.Designer.vb
new file mode 100644
index 00000000..570729cc
--- /dev/null
+++ b/GUIs.Test.DocumentViewerTest/Form2.Designer.vb
@@ -0,0 +1,49 @@
+ _
+Partial Class Form2
+ Inherits System.Windows.Forms.Form
+
+ 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Wird vom Windows Form-Designer benötigt.
+ Private components As System.ComponentModel.IContainer
+
+ 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
+ 'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
+ 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
+ _
+ Private Sub InitializeComponent()
+ Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
+ Me.SuspendLayout()
+ '
+ 'DocumentViewer1
+ '
+ Me.DocumentViewer1.Dock = System.Windows.Forms.DockStyle.Fill
+ Me.DocumentViewer1.Location = New System.Drawing.Point(0, 0)
+ Me.DocumentViewer1.Name = "DocumentViewer1"
+ Me.DocumentViewer1.Size = New System.Drawing.Size(800, 450)
+ Me.DocumentViewer1.TabIndex = 0
+ '
+ 'Form2
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(800, 450)
+ Me.Controls.Add(Me.DocumentViewer1)
+ Me.Name = "Form2"
+ Me.Text = "Form2"
+ Me.ResumeLayout(False)
+
+ End Sub
+
+ Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer
+End Class
diff --git a/GUIs.Test.DocumentViewerTest/Form2.resx b/GUIs.Test.DocumentViewerTest/Form2.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/GUIs.Test.DocumentViewerTest/Form2.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/GUIs.Test.DocumentViewerTest/Form2.vb b/GUIs.Test.DocumentViewerTest/Form2.vb
new file mode 100644
index 00000000..08004a54
--- /dev/null
+++ b/GUIs.Test.DocumentViewerTest/Form2.vb
@@ -0,0 +1,40 @@
+Imports System.ComponentModel
+Imports DigitalData.Modules.Logging
+
+Public Class Form2
+ Public FilePath As String
+ Private Key As String
+ Private LogConfig As LogConfig
+ Private Logger As Logger
+
+ Public Sub New(LogConfig As LogConfig, Key As String)
+ ' Dieser Aufruf ist für den Designer erforderlich.
+ InitializeComponent()
+
+ ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
+ Me.LogConfig = LogConfig
+ Me.Key = Key
+ End Sub
+
+ Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ Logger = LogConfig.GetLogger
+ Logger.Info("DocumentViewer Form Loaded")
+ DocumentViewer1.Init(LogConfig, Key)
+ DocumentViewer1.LoadFile(FilePath)
+ Logger.Info("File Loaded")
+ End Sub
+
+ Private Sub Form2_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
+ Logger.Info("Form closed")
+ End Sub
+
+ Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
+
+ DocumentViewer1.Done()
+ Logger.Info("Form closing")
+
+
+ End Sub
+
+
+End Class
\ No newline at end of file
diff --git a/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj b/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj
index f0c23889..37b2c1e2 100644
--- a/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj
+++ b/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj
@@ -56,10 +56,19 @@
P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\14_11_19_MIME_UTF_ENCODING\Independentsoft.Msg.dll
+
+
+ ..\packages\NLog.4.6.8\lib\net45\NLog.dll
+
+
+
+
+
+
@@ -88,6 +97,12 @@
Form1.vb
Form
+
+ Form2.vb
+
+
+ Form
+
True
@@ -108,6 +123,9 @@
Form1.vb
+
+ Form2.vb
+
VbMyResourcesResXFileCodeGenerator
Resources.Designer.vb
@@ -126,6 +144,7 @@
Settings.Designer.vb
+
diff --git a/GUIs.Test.DocumentViewerTest/packages.config b/GUIs.Test.DocumentViewerTest/packages.config
new file mode 100644
index 00000000..c1fd79a0
--- /dev/null
+++ b/GUIs.Test.DocumentViewerTest/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file