View Single Post
Old 19th December 2014, 07:41   #645  |  Link
Zachs
Suptitle, MediaPlayer.NET
 
Join Date: Nov 2001
Posts: 1,721
Very simple player extension example

PHP Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace 
Mpdn.PlayerExtensions.Example
{
    public class 
Test IPlayerExtension
    
{
        private 
IPlayerControl m_PlayerControl;

        public 
ExtensionDescriptor Descriptor
        
{
            
get
            
{
                return new 
ExtensionDescriptor
                
{
                    
Guid = new Guid("7C3BA1E2-EE7B-47D2-B174-6AE76D65ED04"),
                    
Name "Test",
                    
Description "Player Extension Test",
                    
Copyright "Copyright Test © 2014. All rights reserved."
                
};
            }
        }

        public 
void Initialize(IPlayerControl playerControl)
        {
            
m_PlayerControl playerControl;
            
m_PlayerControl.KeyDown += PlayerKeyDown;
        }

        public 
void Destroy()
        {
            
m_PlayerControl.KeyDown -= PlayerKeyDown;
        }

        public 
IList<VerbVerbs
        
{
            
get
            
{
                return new[]
                {
                    new 
Verb(Category.Helpstring.Empty, "Test""Ctrl+Shift+T""test test test 1"Test1Click),
                    new 
Verb(Category.Help"Test sub category""Test""Ctrl+Shift+R""test test test 2"Test2Click)
                };
            }
        }

        private 
void Test1Click()
        {
            
MessageBox.Show("Test1");
        }

        private 
void Test2Click()
        {
            
MessageBox.Show("Test2");
        }

        private 
void PlayerKeyDown(object senderPlayerKeyEventArgs e)
        {
            switch (
e.Key.KeyData)
            {
                case 
Keys.Control Keys.Shift Keys.T:
                    
Test1Click();
                    break;
                case 
Keys.Control Keys.Shift Keys.R:
                    
Test2Click();
                    break;
            }
        }
    }


Last edited by Zachs; 19th December 2014 at 07:47.
Zachs is offline   Reply With Quote