I'm writing a Application where i need to list multiple Modules. The Problem is that every Module i load, is the actually the first Module i have loaded.
Function to open a Module:
The code which calls the function:
Every Module inthe List "modules" is the the First Module. So the list looks like this:
Module 1
Module 1
Module 1
But i should look like this:
Module 1
Module 2
Module 3
Hope someone can help
Function to open a Module:
Quellcode
- Public Function openModule(path As String) As ctxModule.ctxModule
- Dim asm As Assembly = Nothing
- Dim myType As System.Type = Nothing
- Dim implementsIPlugin As Boolean = Nothing
- Try
- asm = Assembly.LoadFrom(path)
- Dim fullClassName As String = "Main"
- myType = asm.GetType(fullClassName)
- implementsIPlugin = GetType(ctxModule.ctxModule).IsAssignableFrom(myType)
- If implementsIPlugin Then
- Return Activator.CreateInstance(myType)
- End If
- Catch ex As Exception
- End Try
- Return Nothing
- End Function
The code which calls the function:
Quellcode
- Public Sub load_modules()
- modules.Clear()
- modulePaths.Clear()
- For Each F As String In My.Computer.FileSystem.GetFiles(path_modules)
- If F.EndsWith(".03MDL") Then
- Dim m As ctxModule.ctxModule = Nothing
- m = openModule(F)
- If IsNothing(m) = False Then
- modules.Add(m)
- modulePaths.Add(m, F)
- Else : End If
- m = Nothing
- Else : End If
- Next
- End Sub
Every Module inthe List "modules" is the the First Module. So the list looks like this:
Module 1
Module 1
Module 1
But i should look like this:
Module 1
Module 2
Module 3
Hope someone can help