Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form Dim WithEvents fw As New FileSystemWatcher #Region " Vom Windows Form Designer generierter Code " Public Sub New() MyBase.New() ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() ' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen End Sub ' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub ' Für Windows Form-Designer erforderlich Private components As System.ComponentModel.IContainer 'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich 'Sie kann mit dem Windows Form-Designer modifiziert werden. 'Verwenden Sie nicht den Code-Editor zur Bearbeitung. Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Button5 As System.Windows.Forms.Button Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) Me.Button1 = New System.Windows.Forms.Button() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.Button2 = New System.Windows.Forms.Button() Me.Button3 = New System.Windows.Forms.Button() Me.Button4 = New System.Windows.Forms.Button() Me.Label3 = New System.Windows.Forms.Label() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.TextBox2 = New System.Windows.Forms.TextBox() Me.Label4 = New System.Windows.Forms.Label() Me.Button5 = New System.Windows.Forms.Button() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(232, 8) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(22, 22) Me.Button1.TabIndex = 1 Me.Button1.Text = "..." ' 'ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(0, 96) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(256, 69) Me.ListBox1.TabIndex = 2 ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(232, 32) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(22, 22) Me.Button2.TabIndex = 4 Me.Button2.Text = "..." ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(160, 64) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(96, 23) Me.Button3.TabIndex = 5 Me.Button3.Text = "Journal löschen" ' 'Button4 ' Me.Button4.BackgroundImage = CType(resources.GetObject("Button4.BackgroundImage"), System.Drawing.Bitmap) Me.Button4.Location = New System.Drawing.Point(8, 64) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(24, 23) Me.Button4.TabIndex = 6 Me.ToolTip1.SetToolTip(Me.Button4, "Überwachung stoppen") Me.Button4.Visible = False ' 'Label3 ' Me.Label3.Location = New System.Drawing.Point(8, 8) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(48, 23) Me.Label3.TabIndex = 7 Me.Label3.Text = "Input:" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(56, 8) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(176, 20) Me.TextBox1.TabIndex = 8 Me.TextBox1.Text = "d:\edoka\edkb07" ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(56, 32) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(176, 20) Me.TextBox2.TabIndex = 9 Me.TextBox2.Text = "d:\edoka\edkb07" ' 'Label4 ' Me.Label4.Location = New System.Drawing.Point(8, 40) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(48, 23) Me.Label4.TabIndex = 10 Me.Label4.Text = "Output" ' 'Button5 ' Me.Button5.BackgroundImage = CType(resources.GetObject("Button5.BackgroundImage"), System.Drawing.Bitmap) Me.Button5.Location = New System.Drawing.Point(8, 64) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(24, 23) Me.Button5.TabIndex = 11 Me.ToolTip1.SetToolTip(Me.Button5, "Überwachung starten") ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(264, 173) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button5, Me.Label4, Me.TextBox2, Me.TextBox1, Me.Label3, Me.Button4, Me.Button3, Me.Button2, Me.ListBox1, Me.Button1}) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "Form1" Me.Text = "Banklagernd COLD-Simulator" Me.WindowState = System.Windows.Forms.FormWindowState.Minimized Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Me.Label1.Text = Me.FolderBrowserDialog1.SelectedPath 'Me.Label2.Text = Me.FolderBrowserDialog1.SelectedPath 'fw.Path = Me.FolderBrowserDialog1.SelectedPath 'fw.Filter = "*.txt" 'fw.EnableRaisingEvents = True fw.Path = Me.TextBox1.Text fw.Filter = "*.txt" fw.EnableRaisingEvents = True Me.Button5.Visible = False Me.Button4.Visible = True End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim f As New FolderSelect() f.ShowDialog() Me.TextBox1.Text = f.fullPath End Sub Private Sub fw_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles fw.Created Me.ListBox1.Items.Add("Processing: " & e.Name) System.Threading.Thread.Sleep(5000) Dim na As String Dim na1 As String na = Microsoft.VisualBasic.Left(e.Name, InStr(e.Name, ".", CompareMethod.Text) - 1) na1 = UCase(na) If na1 = "RETURN" Or na1 = "UPDATEEDK" Or na1 = "UPDATEBL" Or na1 = "RETURN" Or na1 = "FILECOUNT" Or na1 = "DOSTART" Or na1 = "DUMMY" Or na1 = "DTOFILETRANSFERTXT" Or na1 = "DTOFILETRANSFERBIN" Then Exit Sub End If FileCopy(Me.TextBox1.Text + "\testoutput.pdf", Me.TextBox2.Text & "\" & na & ".pdf") Me.ListBox1.Items.Add("Finished: " & na & ".pdf") File.Delete(e.FullPath) Dim owriter As New StreamWriter(Me.TextBox2.Text & "\" & na & ".ret") owriter.WriteLine("0") owriter.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim f As New FolderSelect() f.ShowDialog() Me.TextBox2.Text = f.fullPath End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.ListBox1.Items.Clear() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Button5.Visible = True Me.Button4.Visible = False fw.EnableRaisingEvents = False MsgBox("Überwachung gestoppt.") End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click fw.Path = Me.TextBox1.Text fw.Filter = "*.txt" fw.EnableRaisingEvents = True Me.Button5.Visible = False Me.Button4.Visible = True MsgBox("Überwachung gestartet") End Sub End Class