Difference between revisions of "Tips and Tricks for developing a plugin in Visual Studio 2005 .NET"

From JRiverWiki
Jump to: navigation, search
(Handling an event)
Line 13: Line 13:
 
This is a sample on how to handle events fired by MC.
 
This is a sample on how to handle events fired by MC.
  
private void MJEvent(String s1 , String s2, String s3 )
+
private void MJEvent(String s1 , String s2, String s3 )
{
+
{
    switch (s1)
+
    switch (s1)
    {
+
    {
        case "MJEvent type: MCCommand":
+
        case "MJEvent type: MCCommand":
            switch (s2)
+
            switch (s2)
            {
+
            {
                case "MCC: NOTIFY_TRACK_CHANGE":
+
                case "MCC: NOTIFY_TRACK_CHANGE":
                    fillTrackInfo ();
+
                    // Your code here
                    setEqualizer ();
+
                    break;
+
 
                    break;
+
                case "MCC: NOTIFY_PLAYLIST_ADDED":
+
                    // Your code here
                case "MCC: NOTIFY_PLAYLIST_ADDED":
+
                    break;
                    break;
+
 
+
                case "MCC: NOTIFY_PLAYLIST_INFO_CHANGED":
                case "MCC: NOTIFY_PLAYLIST_INFO_CHANGED":
+
                    // Your code here
                    break;
+
                    break;
+
 
                case "MCC: NOTIFY_PLAYLIST_FILES_CHANGED":
+
                case "MCC: NOTIFY_PLAYLIST_FILES_CHANGED":
                    break;
+
                    // Your code here
+
                    break;
                case "MCC: NOTIFY_PLAYLIST_REMOVED":
+
 
                    break;
+
                case "MCC: NOTIFY_PLAYLIST_REMOVED":
+
                    // Your code here
                case "MCC: NOTIFY_PLAYLIST_COLLECTION_CHANGED":
+
                    break;
                    break;
+
 
+
                case "MCC: NOTIFY_PLAYLIST_COLLECTION_CHANGED":
                case "MCC: NOTIFY_PLAYLIST_PROPERTIES_CHANGED":
+
                    // Your code here
                    break;
+
                    break;
            }
+
 
+
                case "MCC: NOTIFY_PLAYLIST_PROPERTIES_CHANGED":
            break;
+
                    // Your code here
+
                    break;
        default:
+
            }
            break;
+
 
    }
+
            break;
}
+
 
 +
        default:
 +
            break;
 +
    }
 +
}

Revision as of 07:16, 8 April 2007

Create a new plugin

Use the description of Mr ChriZ to create a new Plugin. http://yabb.jriver.com/interact/index.php?topic=32294.0

Autoresizing of plugin

Draw a Panel upon the UserControl and do the following:
- Set 'Dock' Property to 'Fill'.
- Set 'Autosize' Property to 'False'

Your Panel will now automatically be resized to fit into the MC Plugin Area. Anything you put upon the Panel can scale to the size of the Panel using the 'Anchor' or 'Dock' Properties. Don't use the 'Autosize' Property!

Handling an event

This is a sample on how to handle events fired by MC.

private void MJEvent(String s1 , String s2, String s3 )
{
    switch (s1)
    {
        case "MJEvent type: MCCommand":
            switch (s2)
            {
                case "MCC: NOTIFY_TRACK_CHANGE":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_ADDED":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_INFO_CHANGED":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_FILES_CHANGED":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_REMOVED":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_COLLECTION_CHANGED":
                    // Your code here
                    break;
 
                case "MCC: NOTIFY_PLAYLIST_PROPERTIES_CHANGED":
                    // Your code here
                    break;
            }
 
            break;
 
        default:
            break;
    }
}