Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents lblManager As System.Windows.Forms.Label
    Friend WithEvents lblClients As System.Windows.Forms.Label
    Friend WithEvents lblApplication As System.Windows.Forms.Label
    Friend WithEvents lblConsole As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.lblManager = New System.Windows.Forms.Label
        Me.lblClients = New System.Windows.Forms.Label
        Me.lblApplication = New System.Windows.Forms.Label
        Me.lblConsole = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'lblManager
        '
        Me.lblManager.BackColor = System.Drawing.Color.Transparent
        Me.lblManager.Location = New System.Drawing.Point(472, 200)
        Me.lblManager.Name = "lblManager"
        Me.lblManager.Size = New System.Drawing.Size(256, 112)
        Me.lblManager.TabIndex = 0
        '
        'lblClients
        '
        Me.lblClients.BackColor = System.Drawing.Color.Transparent
        Me.lblClients.Location = New System.Drawing.Point(512, 440)
        Me.lblClients.Name = "lblClients"
        Me.lblClients.Size = New System.Drawing.Size(256, 192)
        Me.lblClients.TabIndex = 1
        '
        'lblApplication
        '
        Me.lblApplication.BackColor = System.Drawing.Color.Transparent
        Me.lblApplication.Location = New System.Drawing.Point(160, 272)
        Me.lblApplication.Name = "lblApplication"
        Me.lblApplication.Size = New System.Drawing.Size(144, 136)
        Me.lblApplication.TabIndex = 2
        '
        'lblConsole
        '
        Me.lblConsole.BackColor = System.Drawing.Color.Transparent
        Me.lblConsole.Location = New System.Drawing.Point(552, 8)
        Me.lblConsole.Name = "lblConsole"
        Me.lblConsole.Size = New System.Drawing.Size(144, 120)
        Me.lblConsole.TabIndex = 3
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(826, 664)
        Me.Controls.Add(Me.lblConsole)
        Me.Controls.Add(Me.lblApplication)
        Me.Controls.Add(Me.lblClients)
        Me.Controls.Add(Me.lblManager)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Name = "Form1"
        Me.Text = "Presentatie"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private managerFilename As String
    Private clientFilename As String
    Private consoleFilename As String
    Private applicationFilename As String
    Private managerproces As System.Diagnostics.Process
    Private consoleproces As System.Diagnostics.Process
    Private clientproces As System.Diagnostics.Process
    Private applicationproces As System.Diagnostics.Process

    Private Declare Function BringWindowToTop Lib "user32" (ByVal _
             hwnd As IntPtr) As Long
    Private Sub lblManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblManager.Click
        Try
            'proces aanmaken en het starten
            If managerproces Is Nothing Then
                managerproces = New System.diagnostics.Process
                managerproces.StartInfo.FileName = managerFilename
                managerproces.Start()
            Else
                BringWindowToTop(managerproces.MainWindowHandle)
        End If
        Catch ex As InvalidOperationException
        End Try
    End Sub
    

   

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'ophalen verschillende links
        Dim managerdialog As New OpenFileDialog
        With managerdialog
            .Filter = "Executable files (*.exe)|*.exe|" & "All files|*.*"
            .Title = "Give the location of the Manager"

            If .ShowDialog() = DialogResult.OK Then
                managerFilename = .FileName
            End If
        End With
        Dim applicationdialog As New OpenFileDialog
        With applicationdialog
            .Filter = "Executable files (*.exe)|*.exe|" & "All files|*.*"
            .Title = "Give the location of the Application"

            If .ShowDialog() = DialogResult.OK Then
                applicationFilename = .FileName
            End If
        End With
        Dim clientdialog As New OpenFileDialog
        With clientdialog
            .Filter = "Executable files (*.exe)|*.exe|" & "All files|*.*"
            .Title = "Give the location of the client"

            If .ShowDialog() = DialogResult.OK Then
                clientFilename = .FileName
            End If
        End With
        Dim consoledialog As New OpenFileDialog
        With consoledialog
            .Filter = "Executable files (*.exe)|*.exe|" & "All files|*.*"
            .Title = "Give the location of the console"

            If .ShowDialog() = DialogResult.OK Then
                consoleFilename = .FileName
            End If
        End With
    End Sub

    Private Sub lblConsole_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblConsole.Click
        Try
            'proces aanmaken en het starten
            If consoleproces Is Nothing Then
                consoleproces = New System.diagnostics.Process
                consoleproces.StartInfo.FileName = consoleFilename
                consoleproces.Start()
            Else
                BringWindowToTop(consoleproces.MainWindowHandle)
        End If
        Catch ex As InvalidOperationException
        End Try
    End Sub

    Private Sub lblClients_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblClients.Click
        Try
            'proces aanmaken en het starten
            If clientproces Is Nothing Then
                clientproces = New System.diagnostics.Process
                clientproces.StartInfo.FileName = clientFilename
                clientproces.Start()
            Else
                BringWindowToTop(clientproces.MainWindowHandle)
        End If
        Catch ex As InvalidOperationException
        End Try
    End Sub

    Private Sub lblApplication_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblApplication.Click
        Try
            'proces aanmaken en het starten
            If applicationproces Is Nothing Then
                applicationproces = New System.diagnostics.Process
                applicationproces.StartInfo.FileName = applicationFilename
                applicationproces.Start()
            Else
                BringWindowToTop(applicationproces.MainWindowHandle)
            End If
        Catch ex As InvalidOperationException
        End Try
    End Sub

    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

    End Sub
End Class
