New to MP pluggin development (1 Viewer)

LudoJ

Portal Member
August 21, 2006
39
0
42
France
Home Country
France France
Hi guys, I'm new to plugin development.

I'm trying to write a little process plugin. I've followed the "How to write a plugin for MP" tutorial.

For the moment, my goal is very simple, I just want to display a pop-up when MP starts.

Here is hat I've done for now:
Code:
using System;
using System.Windows.Forms;
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;

namespace WhosCalling
{
    public class Class1 : GUIWindow, ISetupForm
    {
        public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}

        #region IPlugin Members
        public void Start()
        {
            GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlg.SetHeading("Hello World");
            dlg.SetLine(1, String.Empty);
            dlg.SetLine(2, String.Empty);
            dlg.SetLine(3, String.Empty);
            dlg.DoModal(GUIWindowManager.ActiveWindow);
        }

        public void Stop()
        {

        }

        #endregion


	#region ISetupForm Members
	// Returns the name of the plugin which is shown in the plugin menu
	public string PluginName()
	{
		return "MyFirstPlugin";
	}



	[...]


	#endregion
	}
}

As you can see, this is very simple...

I can see it and enable it under the configurator, but my pop-up does not show at MP's startup... What am I doing wrong?



At the same time if any one could tell me how to do a thread or a timer, that would be good :)


Ludo...
 

mofux

Portal Designer
  • Premium Supporter
  • January 27, 2006
    678
    34
    Dresden, Germany
    i'm not sure if process plugins are able to popup dialog boxes inside of mp, usually this is done with window plugins... but i could be wrong (never really wrote a process plugin)... however you could try to throw a messagebox to see if the code is reached...

    MessageBox.Show("this is Start() of my first process plugin");
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Yes. Process plugin are able to show dialogs (sometimes it is better to open them in another thread).
    But I'am not sure if MP is able to show a dialog at the moment the process plugins get started.
    Maybe you should try to use a timer to open the dialog a little bit later.

    Bye
    Lars
     

    gemx

    Retired Team Member
  • Premium Supporter
  • October 31, 2006
    1,972
    539
    Home Country
    Germany Germany
    lkuech is right.
    Your code seems to be correct but MediaPortal hasn't finished initialization when the Start() function of the plugin is called, so you should use the MessageBox.Show attempt.
     

    Users who are viewing this thread

    Top Bottom