home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Window plugin showing up as process
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="samuel337" data-source="post: 74081" data-attributes="member: 10347"><p>Ok, I'll use your previous code example to demo what I mean. See the stuff in bold.</p><p></p><p>[code]</p><p>#region Copyright (C) 2006 Team MediaPortal</p><p></p><p>/* </p><p> * Copyright (C) 2006 Team MediaPortal</p><p> * https://www.team-mediaportal.com</p><p> *</p><p> * This Program is free software; you can redistribute it and/or modify</p><p> * it under the terms of the GNU General Public License as published by</p><p> * the Free Software Foundation; either version 2, or (at your option)</p><p> * any later version.</p><p> * </p><p> * This Program is distributed in the hope that it will be useful,</p><p> * but WITHOUT ANY WARRANTY; without even the implied warranty of</p><p> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</p><p> * GNU General Public License for more details.</p><p> * </p><p> * You should have received a copy of the GNU General Public License</p><p> * along with GNU Make; see the file COPYING. If not, write to</p><p> * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. </p><p> * http://www.gnu.org/copyleft/gpl.html</p><p> *</p><p> */</p><p></p><p>#endregion</p><p></p><p>#region XMMImporter: Version History</p><p></p><p>/*</p><p> * XMM Importer</p><p> * </p><p> * Plugin to allow converting Extreme Movie Manager (XMM) databases to</p><p> * MediaPortal.</p><p> * </p><p> * 060827 - JBL - 0.0.0.1</p><p> * Started 060819.</p><p> * </p><p> * This is my first attempt at a C# program and plugin for MediaPortal. This first</p><p> * version of XMM Importer is capable of reading Extreme Movie Manager v5 database</p><p> * files and converting the video data into a MediaPortal video database.</p><p> * </p><p> * Current Version Features:</p><p> * + Configuration control through a MediaPortal plugin interface and a</p><p> * windows form.</p><p> * + Capable of reading XMM v5 database files.</p><p> * + Automatically copies cover files to specified MediaPortal thumbnail directory.</p><p> * </p><p> * Future Work:</p><p> * + Auto detect MediaPortal directories and database files</p><p> * + Save settings to XML or SQLite database to retain settings between uses.</p><p> * + Allow for importing multiple databases by allowing multiple settings in configuration</p><p> * file</p><p> * + Add more control over import information</p><p> * + Relook over SQLite.NET and other MP database code to see if it would work better</p><p> * than the current method of working with SQLite databases</p><p> * + Clean up and add more comments to code for next version</p><p> * </p><p> * Known Issues:</p><p> * + The method of access the MP databases probably isn't optimal. It is currently done</p><p> * using the alternative SQLite interface and a data reader has to be generated each</p><p> * time a query needs to be made. It seems there should be a better way, but seems to</p><p> * work OK for now.</p><p> * + There are no warnings before clearing the data in the video database. The next</p><p> * version should include a warning and even backup the MP video database before working</p><p> * on it.</p><p> * + Only tried on US English version of Windows. May not be compatable with different</p><p> * character sets, but remains to be seen.</p><p> * </p><p> */</p><p>#endregion</p><p></p><p></p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Text;</p><p>//using System.ComponentModel;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p></p><p></p><p>namespace GUIXMM</p><p>{ </p><p> /// <summary></p><p> /// CLASS: XMMImporterPlugin</p><p> /// This is the main plugin interface to MediaPortal.</p><p> /// </summary></p><p> public class XMMImporterPlugin : GUIWindow, ISetupForm</p><p> {</p><p> public XMMImporterPlugin()</p><p> {</p><p> [b]</p><p> //as you have inherited from GUIWindow in this class, you need to specify a windowId for this window. To do this, do the following:</p><p></p><p> GetID=(int)4444;</p><p></p><p> // GetID is a property in the GUIWindow class.</p><p>[/b]</p><p> }</p><p></p><p> #region ISetupForm Members</p><p> </p><p> //Returns the name of the plugin which is shown in the plugin menu</p><p> public string PluginName()</p><p> {</p><p> return "XMMImporter";</p><p> }</p><p> //Returns the description of the plugin is shown in the plugin menu</p><p> public string Description()</p><p> {</p><p> return "Imports XMM Libraries into the MediaPortal database";</p><p> }</p><p> // Returns the author of the plugin which is shown in the plugin menu</p><p> public string Author()</p><p> {</p><p> return "Hesse";</p><p> }</p><p> // Show the setup dialog</p><p> public void ShowPlugin()</p><p> {</p><p> //MessageBox.Show("Nothing to do now");</p><p> XMMImportForm myXMMImporterForm = new XMMImportForm();</p><p> myXMMImporterForm.Show();</p><p> }</p><p> //Indicates whether plugin can be enabled/disabled</p><p> public bool CanEnable()</p><p> {</p><p> return true;</p><p> }</p><p> // Indicates if a plugin is enabled by default</p><p> public bool DefaultEnabled()</p><p> {</p><p> return false;</p><p> }</p><p> // get ID Of windowplugin belonging to this setup</p><p> public int GetWindowId()</p><p> {</p><p> [b]return 4444; //this window ID has to be *one* of the window ids of your windows - a window is defined as a class that has inherited from GUIWindow.[/b]</p><p> }</p><p> // Indicates if a plugin has its own setup screen</p><p> public bool HasSetup()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> /// <summary></p><p> /// If the plugin should have its own button on the main menu of Media Portal then it</p><p> /// should return true to this method, otherwise if it should not be on home</p><p> /// it should return false</p><p> /// </summary></p><p> /// <param name="strButtonText">text the button should have</param></p><p> /// <param name="strButtonImage">image for the button, or empty for default</param></p><p> /// <param name="strButtonImageFocus">image for the button, or empty for default</param></p><p> /// <param name="strPictureImage">subpicture for the button or empty for none</param></p><p> /// <returns>true : plugin needs its own button on home</p><p> /// false : plugin does not need its own button on home</returns></p><p></p><p> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText = "XMMImporter";</p><p> strButtonImage = "";</p><p> strButtonImageFocus = "";</p><p> strPictureImage = "";</p><p> return true;</p><p> }</p><p> #endregion</p><p></p><p> }</p><p></p><p> </p><p>}</p><p>[/code]</p><p></p><p>That should fix it. </p><p></p><p>BTW, when you inherited from GUIWindow, you should also override the following methods to do things like load the skin, capture actions/messages etc. Here's the overrides you should do:</p><p></p><p>[code]</p><p> #region Overrides</p><p></p><p> public override bool Init()</p><p> {</p><p> return Load(MediaPortal.GUI.Library.GUIGraphicsContext.Skin + @"\threaddemo.xml");</p><p> }</p><p></p><p> public override void OnAction(MediaPortal.GUI.Library.Action action)</p><p> {</p><p> switch (action.wID)</p><p> {</p><p> case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU:</p><p> {</p><p> MediaPortal.GUI.Library.GUIWindowManager.ShowPreviousWindow();</p><p> return;</p><p> }</p><p> }</p><p></p><p> base.OnAction(action);</p><p> }</p><p></p><p> public override bool OnMessage(MediaPortal.GUI.Library.GUIMessage message)</p><p> {</p><p> switch (message.Message)</p><p> {</p><p></p><p> case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:</p><p> {</p><p> base.OnMessage(message);</p><p> </p><p>//code here runs every time the window is displayed</p><p>MediaPortal.GUI.Library.GUIPropertyManager.SetProperty("#currentmodule", "Plugin Name");</p><p> </p><p> break;</p><p> }</p><p> case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_CLICKED:</p><p> {</p><p></p><p> break;</p><p> }</p><p></p><p> case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:</p><p> {</p><p></p><p> }</p><p> break;</p><p></p><p> }</p><p> return base.OnMessage(message);</p><p></p><p> }</p><p> #endregion</p><p>[/code]</p><p></p><p>HTH</p><p></p><p>Sam</p></blockquote><p></p>
[QUOTE="samuel337, post: 74081, member: 10347"] Ok, I'll use your previous code example to demo what I mean. See the stuff in bold. [code] #region Copyright (C) 2006 Team MediaPortal /* * Copyright (C) 2006 Team MediaPortal * https://www.team-mediaportal.com * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #endregion #region XMMImporter: Version History /* * XMM Importer * * Plugin to allow converting Extreme Movie Manager (XMM) databases to * MediaPortal. * * 060827 - JBL - 0.0.0.1 * Started 060819. * * This is my first attempt at a C# program and plugin for MediaPortal. This first * version of XMM Importer is capable of reading Extreme Movie Manager v5 database * files and converting the video data into a MediaPortal video database. * * Current Version Features: * + Configuration control through a MediaPortal plugin interface and a * windows form. * + Capable of reading XMM v5 database files. * + Automatically copies cover files to specified MediaPortal thumbnail directory. * * Future Work: * + Auto detect MediaPortal directories and database files * + Save settings to XML or SQLite database to retain settings between uses. * + Allow for importing multiple databases by allowing multiple settings in configuration * file * + Add more control over import information * + Relook over SQLite.NET and other MP database code to see if it would work better * than the current method of working with SQLite databases * + Clean up and add more comments to code for next version * * Known Issues: * + The method of access the MP databases probably isn't optimal. It is currently done * using the alternative SQLite interface and a data reader has to be generated each * time a query needs to be made. It seems there should be a better way, but seems to * work OK for now. * + There are no warnings before clearing the data in the video database. The next * version should include a warning and even backup the MP video database before working * on it. * + Only tried on US English version of Windows. May not be compatable with different * character sets, but remains to be seen. * */ #endregion using System; using System.Collections.Generic; using System.Text; //using System.ComponentModel; using System.Windows.Forms; using MediaPortal.GUI.Library; namespace GUIXMM { /// <summary> /// CLASS: XMMImporterPlugin /// This is the main plugin interface to MediaPortal. /// </summary> public class XMMImporterPlugin : GUIWindow, ISetupForm { public XMMImporterPlugin() { [b] //as you have inherited from GUIWindow in this class, you need to specify a windowId for this window. To do this, do the following: GetID=(int)4444; // GetID is a property in the GUIWindow class. [/b] } #region ISetupForm Members //Returns the name of the plugin which is shown in the plugin menu public string PluginName() { return "XMMImporter"; } //Returns the description of the plugin is shown in the plugin menu public string Description() { return "Imports XMM Libraries into the MediaPortal database"; } // Returns the author of the plugin which is shown in the plugin menu public string Author() { return "Hesse"; } // Show the setup dialog public void ShowPlugin() { //MessageBox.Show("Nothing to do now"); XMMImportForm myXMMImporterForm = new XMMImportForm(); myXMMImporterForm.Show(); } //Indicates whether plugin can be enabled/disabled public bool CanEnable() { return true; } // Indicates if a plugin is enabled by default public bool DefaultEnabled() { return false; } // get ID Of windowplugin belonging to this setup public int GetWindowId() { [b]return 4444; //this window ID has to be *one* of the window ids of your windows - a window is defined as a class that has inherited from GUIWindow.[/b] } // Indicates if a plugin has its own setup screen public bool HasSetup() { return true; } /// <summary> /// If the plugin should have its own button on the main menu of Media Portal 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 its own button on home /// false : plugin does not need its own button on home</returns> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { strButtonText = "XMMImporter"; strButtonImage = ""; strButtonImageFocus = ""; strPictureImage = ""; return true; } #endregion } } [/code] That should fix it. BTW, when you inherited from GUIWindow, you should also override the following methods to do things like load the skin, capture actions/messages etc. Here's the overrides you should do: [code] #region Overrides public override bool Init() { return Load(MediaPortal.GUI.Library.GUIGraphicsContext.Skin + @"\threaddemo.xml"); } public override void OnAction(MediaPortal.GUI.Library.Action action) { switch (action.wID) { case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU: { MediaPortal.GUI.Library.GUIWindowManager.ShowPreviousWindow(); return; } } base.OnAction(action); } public override bool OnMessage(MediaPortal.GUI.Library.GUIMessage message) { switch (message.Message) { case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { base.OnMessage(message); //code here runs every time the window is displayed MediaPortal.GUI.Library.GUIPropertyManager.SetProperty("#currentmodule", "Plugin Name"); break; } case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_CLICKED: { break; } case MediaPortal.GUI.Library.GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: { } break; } return base.OnMessage(message); } #endregion [/code] HTH Sam [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Window plugin showing up as process
Contact us
RSS
Top
Bottom