INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: mcevents in vb.net?  (Read 1774 times)

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
mcevents in vb.net?
« on: April 10, 2007, 07:10:46 pm »

how can i get mcevents working in vb.net.
i read the wiki, and a lot more, tried anything i can think of.
does somebody have an example?
Logged

jbholtz

  • Recent member
  • *
  • Posts: 49
Re: mcevents in vb.net?
« Reply #1 on: April 12, 2007, 12:47:43 pm »

If your using Mr. ChriZ pluging template, you'll have to change the Declaration section to be
     Private WithEvents mediaCenterRef As MediaCenter.MCAutomation

The WithEvents handles the registration for you.  Then of course add your handler:
     Public Sub mediaCenter_FireMJEventHandler(ByVal bstrType As String, _
                                     ByVal bstrParam1 As String, _
                                     ByVal bstrParam2 As String) _
                                     Handles mediaCenterRef.FireMJEvent
     ' Add your code here
     ' See....http://wiki.jrmediacenter.com/index.php/Tips_and_Tricks_for_developing_a_plugin_in_Visual_Studio_2005_.NET
     End Sub
Although I prefer doing this in C#, I'm quickly learning that there really isn't anything different about the two languages
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: mcevents in vb.net?
« Reply #2 on: April 12, 2007, 05:16:08 pm »

thanks a lot.  :)
but this was how far i already got using this part of the wiki
http://wiki.jrmediacenter.com/index.php/Media_Center_Automation#Event_Handling
the problem is that i now vba and some visual basic, but not visualbasic 2005. and i was thinking much to complex. though i had to call the sub mjevent or firemjevent somewere somehow. used handlers, raiseevent and much more. nothing worked. it just becamse clear to me that the code should work just as it is. this
sub blabla handels shhh is new to me.

still i miss something. cause it does not work.  >:(
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: mcevents in vb.net?
« Reply #3 on: April 13, 2007, 01:29:00 am »

'you'll have to change the Declaration section to be Private WithEvents'
and not just put dim withevents mc etc somewhere underneath it and use that for the eventhandling.
that was a long road to get something simple to work.
thanks again jbholtz, it was not 'how far i already got'. just had to sleep one night over it to see.
 
Logged
Pages: [1]   Go Up