registering event handlers from c#.net app

Post a reply

Visual Confirmation

To prevent automated access and spam, you are required to confirm that you are human. Please place a check mark next to all images of monkeys or apes. If you cannot see any images, please contact the Board Administrator.

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: registering event handlers from c#.net app

Re: registering event handlers from c#.net app

Post by Melloware » Wed Dec 02, 2009 6:58 pm

You can't do it this way. The only way to do it is to use a COM object and call it from MM before your C# code will receive events.

See this thread for example code:

http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=14004&p=69933&hilit=com+events#p69933

registering event handlers from c#.net app

Post by llcj » Fri Oct 09, 2009 4:55 pm

Hi I'm trying to update a textBox from an external C#.net application using the OnTrackEnd,OnPlay and OnPause event handler but I'm getting no updates to my text box.

Any suggestions?

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

///////////MediaMonkey
using SongsDB;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        SongsDB.SDBApplicationClass mm = new SongsDB.SDBApplicationClass();

        private void Form1_Load(object sender, EventArgs e)
        {
            mm.OnTrackEnd += new SongsDB.ISDBApplicationEvents_OnTrackEndEventHandler(handletrackchange);
            mm.OnPlay += new SongsDB.ISDBApplicationEvents_OnPlayEventHandler(handleonplay);
            mm.OnPause += new SongsDB.ISDBApplicationEvents_OnPauseEventHandler(handleonplay);
        }

        private void handletrackchange()
        {
            textBox1.Text += "1";
        }

        private void handleonplay()
        {
            textBox1.Text += "p";
        }
    }
}



Top