Help with very simple plugin please! (1 Viewer)

domb

Portal Pro
October 30, 2006
213
7
Hi, I've never coded anything in my life but I'm trying to create a very simple Blu-ray launcher plugin. I know there are some others out there but none seem to work as I would like. All I'm trynig to do at the moment is get the plug-in to read when a Blu-ray disc has been inserted and then launch notepad but it doesn't do anything at the moment. Would someone be able to tell me where I'm going wrong? Code below:

Code:
using System;
using System.Windows.Forms;
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;
using MediaPortal.Common.Utils;

namespace OurPlugin
{
    public class Class1 : GUIWindow, ISetupForm
    {

        public Class1()
        {

        }

        //
        // Handle Blu-ray message and launch player
        //

        private void OnGlobalMessage(GUIMessage message)
        {
            switch (message.Message)
            {
                case GUIMessage.MessageType.GUI_MSG_BLURAY_DISK_INSERTED:
                    Log.Info("CinePlayer:GUI_MSG_BLURAY_DISK_INSERTED");
                    {
                        System.Diagnostics.Process.Start(@"C:\Windows\System32\Notepad.exe");
                    }
                    break;
            }
        }

                              
        #region ISetupForm Members

        // Returns the name of the plugin which is shown in the plugin menu
        public string PluginName()
        {
            return "Launch CinePlayer on Blu-ray";
        }

        // Returns the description of the plugin is shown in the plugin menu
        public string Description()
        {
            return "Launch CinePlayer on Blu-ray";
        }

        // Returns the author of the plugin which is shown in the plugin menu
        public string Author()
        {
            return "Dominic Bird";
        }

        // show the setup dialog
        public void ShowPlugin()
        {
            MessageBox.Show("Nothing to configure, this is just an example");
        }

        // Indicates whether plugin can be enabled/disabled
        public bool CanEnable()
        {
            return true;
        }

        // Get Windows-ID
        public int GetWindowId()
        {
            // WindowID of windowplugin belonging to this setup
            // enter your own unique code
            return 5678;
        }

        // Indicates if plugin is enabled by default;
        public bool DefaultEnabled()
        {
            return true;
        }

        // indicates if a plugin has it's own setup screen
        public bool HasSetup()
        {
            return false;
        }

        /// <summary>
        /// If the plugin should have it's own button on the main menu of MediaPortal then it
        /// should return true to this method, otherwise if it should not be on home
        /// it should return false
        /// </summary>
        /// <param name="strButtonText">text the button should have</param>
        /// <param name="strButtonImage">image for the button, or empty for default</param>
        /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
        /// <param name="strPictureImage">subpicture for the button or empty for none</param>
        /// <returns>true : plugin needs it's own button on home
        /// false : plugin does not need it's own button on home</returns>

        public bool GetHome(out string strButtonText, out string strButtonImage,
          out string strButtonImageFocus, out string strPictureImage)
        {
            strButtonText = String.Empty;
            strButtonImage = String.Empty;
            strButtonImageFocus = String.Empty;
            strPictureImage = String.Empty;
            return false;
        }

        // With GetID it will be an window-plugin / otherwise a process-plugin
        // Enter the id number here again
        public override int GetID
        {
            get
            {
                return 5678;
            }

            set
            {
            }
        }

        #endregion



    }
}
 

Users who are viewing this thread

Top Bottom