Author Topic: vaProxy in AddressOf sub for Addhandler  (Read 6037 times)

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
vaProxy in AddressOf sub for Addhandler
« on: June 28, 2018, 07:36:27 PM »
Hello good souls,
I am stuck with vaProxy in a sub raised by the AdressOf command, the vaProxy is of curse not recognized in this sub.
How Can i make this works ? Please help.
The code is in VB.net on visual sutio 2017 and I am trying to make a plugin.dll for VA that can watch a directory for new files, and execute a command with vaProxy.

Code: [Select]
Public Class Class1
    Private audio_path As String
    Private Shared WithEvents watchfolder As New FileSystemWatcher

    Public Shared Function VA_DisplayName() As String
        ...
    End Function

    Public Shared Function VA_Id() As Guid
        ...
    End Function

    Public Shared Function VA_DisplayInfo() As String
        ...
    End Function

    Public Shared Sub VA_Init1(vaProxy As Object)
        watchfolder.Path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)"
        watchfolder.Filter = IO.Path.GetFileName(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))
        watchfolder.EnableRaisingEvents = True
        AddHandler watchfolder.Created, AddressOf OnChanged
    End Sub

    Public Shared Sub VA_Exit1(vaProxy As Object)
        ...
    End Sub

    Public Shared Sub VA_StopCommand()
        ...
    End Sub

    Public Shared Sub VA_Invoke1(vaProxy As Object)
        ...
    End Sub

    Private Shared Sub OnChanged(source As Object, e As FileSystemEventArgs)
        ' Specify what is done when a file is changed, created, or deleted.
        vaProxy.ExecuteCommand("(( new message ))", True)
    End Sub

End Class
« Last Edit: June 29, 2018, 07:38:18 AM by kourou »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: vaProxy in AddressOf sub for Addhandler
« Reply #1 on: June 28, 2018, 08:15:15 PM »
Just shooting from the hip, but I would look to make sure that the .dll you are creating is using .net framework 4.5 and has a platform target of x86.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: vaProxy in AddressOf sub for Addhandler
« Reply #2 on: June 29, 2018, 07:16:03 AM »
It's a class library .NET Framework 4.6.1 project.
I have 1 error, it's vaProxy in the sub OnChanged.
Quote
'vaProxy' is not declared. It may be inaccessible due to it's protection level.
I know it's normal but i don't have other way to raise a vaProxy.ExecuteCommand with AdressOf.
If there is another way I'll take it.
PS: sorry there is no [s ][ /s] arround vaProxy in my code, just msg editing issues... :P

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: vaProxy in AddressOf sub for Addhandler
« Reply #3 on: June 29, 2018, 09:20:45 AM »
Quote
Just shooting from the hip, but I would look to make sure that the .dll you are creating is using .net framework 4.5 and has a platform target of x86.

Quote
It's a class library .NET Framework 4.6.1 project.


Make sure your plugin is targeting .net 4.5, otherwise it will not work.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: vaProxy in AddressOf sub for Addhandler
« Reply #4 on: June 29, 2018, 10:56:18 AM »
Actually I have a problem with generating/debuging the .dll before loading the plugin into VA
Otherwise no change with the Framework 4.5

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: vaProxy in AddressOf sub for Addhandler
« Reply #5 on: July 03, 2018, 12:36:04 PM »
No ideas ? someone ? :-\