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
[Test] Plugin voice remote controle
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="guilhem" data-source="post: 45434" data-attributes="member: 19445"><p>It's the first process plugin i made, so i don't know if i made error on it and i find no explantion in my code in MP code.</p><p></p><p>Here my code (sorry comments are in most case in FRench)</p><p></p><p>[code]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Text;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p>using ACTIVELISTENPROJECTLib;</p><p></p><p>namespace TelecommandeVocale</p><p>{</p><p> public class Main : ISetupForm, IPlugin</p><p> {</p><p></p><p> // ******************************************</p><p> // *** D2claration</p><p> // ******************************************</p><p> private const String CRLF = "\r\n";</p><p> private DirectSRClass _vcrVoice = new DirectSRClass();</p><p> private String _speechGrammer = "[Grammar]" + CRLF +</p><p> "langid = 1033" + CRLF +</p><p> "type=cfg" + CRLF +</p><p> "[<Start>]" + CRLF +</p><p> "<start>=tv down" + CRLF +</p><p> "<start>=tv up" + CRLF +</p><p> "<start>=tv left" + CRLF +</p><p> "<start>=tv enter" + CRLF +</p><p> "<start>=tv right" + CRLF +</p><p> "<start>=tv back" + CRLF</p><p> ;</p><p></p><p> //</p><p> // Constructeur</p><p> public Main()</p><p> {</p><p> }</p><p></p><p></p><p> // ******************************************</p><p> // *** Partie du formulaire du SETUP</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 "Telecommande Vocale";</p><p> }</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 "Télécommander MP à la voix";</p><p> }</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 "Guilhem";</p><p> }</p><p></p><p> // show the setup dialog</p><p> public void ShowPlugin()</p><p> {</p><p> MessageBox.Show("Non encore implementé"); </p><p> }</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></p><p> // get ID of windowplugin belonging to this setup</p><p> public int GetWindowId()</p><p> {</p><p> return 6780;</p><p> }</p><p></p><p> // Indicates if plugin is enabled by default;</p><p> public bool DefaultEnabled()</p><p> {</p><p> return true;</p><p> }</p><p></p><p></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> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText = PluginName();</p><p> strButtonImage = String.Empty;</p><p> strButtonImageFocus = String.Empty;</p><p> strPictureImage = String.Empty;</p><p> return true;</p><p> }</p><p> #endregion</p><p></p><p></p><p> // ******************************************</p><p> // *** Plugin process</p><p> // ******************************************</p><p> #region IPlugin Members</p><p></p><p> public void Start()</p><p> {</p><p> </p><p> _vcrVoice.GrammarFromString(_speechGrammer);</p><p> _vcrVoice.Activate();</p><p></p><p> _vcrVoice.PhraseFinish += new _DirectSREvents_PhraseFinishEventHandler(vcrVoice_PhraseFinish);</p><p> </p><p> }</p><p></p><p> public void Stop()</p><p> {</p><p> _vcrVoice.Deactivate();</p><p> }</p><p> #endregion </p><p></p><p> // ******************************************</p><p> // *** TELECOMMANDE </p><p> // ******************************************</p><p> </p><p></p><p></p><p> /// <summary></p><p> /// Gestion de l'action</p><p> /// </summary></p><p> /// <param name="flags"></param></p><p> /// <param name="beginhi"></param></p><p> /// <param name="beginlo"></param></p><p> /// <param name="endhi"></param></p><p> /// <param name="endlo"></param></p><p> /// <param name="Phrase"></param></p><p> /// <param name="parsed"></param></p><p> /// <param name="results"></param></p><p> public void vcrVoice_PhraseFinish(int flags, int beginhi, int beginlo, int endhi, int endlo, String Phrase, String parsed, int results)</p><p> {</p><p> </p><p> switch (Phrase)</p><p> {</p><p> </p><p> case "tv down":</p><p> SendKeys.Send("{DOWN}");</p><p> break;</p><p> case "tv up":</p><p> SendKeys.Send("{UP}");</p><p> break;</p><p> case "tv left":</p><p> SendKeys.Send("{LEFT}");</p><p> break;</p><p> case "tv right":</p><p> SendKeys.Send("{RIGHT}");</p><p> break;</p><p> case "tv enter":</p><p> SendKeys.Send("{ENTER}");</p><p> break;</p><p> case "tv back":</p><p> SendKeys.Send("{ESC}");</p><p> break;</p><p> }</p><p> </p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>If anyone find the enormous error, thanks to tell me.</p></blockquote><p></p>
[QUOTE="guilhem, post: 45434, member: 19445"] It's the first process plugin i made, so i don't know if i made error on it and i find no explantion in my code in MP code. Here my code (sorry comments are in most case in FRench) [code] using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using MediaPortal.GUI.Library; using ACTIVELISTENPROJECTLib; namespace TelecommandeVocale { public class Main : ISetupForm, IPlugin { // ****************************************** // *** D2claration // ****************************************** private const String CRLF = "\r\n"; private DirectSRClass _vcrVoice = new DirectSRClass(); private String _speechGrammer = "[Grammar]" + CRLF + "langid = 1033" + CRLF + "type=cfg" + CRLF + "[<Start>]" + CRLF + "<start>=tv down" + CRLF + "<start>=tv up" + CRLF + "<start>=tv left" + CRLF + "<start>=tv enter" + CRLF + "<start>=tv right" + CRLF + "<start>=tv back" + CRLF ; // // Constructeur public Main() { } // ****************************************** // *** Partie du formulaire du SETUP // ****************************************** #region ISetupForm Members // Returns the name of the plugin which is shown in the plugin menu public string PluginName() { return "Telecommande Vocale"; } // Returns the description of the plugin is shown in the plugin menu public string Description() { return "Télécommander MP à la voix"; } // Returns the author of the plugin which is shown in the plugin menu public string Author() { return "Guilhem"; } // show the setup dialog public void ShowPlugin() { MessageBox.Show("Non encore implementé"); } // Indicates whether plugin can be enabled/disabled public bool CanEnable() { return true; } // get ID of windowplugin belonging to this setup public int GetWindowId() { return 6780; } // Indicates if plugin is enabled by default; public bool DefaultEnabled() { return true; } // 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 = PluginName(); strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = String.Empty; return true; } #endregion // ****************************************** // *** Plugin process // ****************************************** #region IPlugin Members public void Start() { _vcrVoice.GrammarFromString(_speechGrammer); _vcrVoice.Activate(); _vcrVoice.PhraseFinish += new _DirectSREvents_PhraseFinishEventHandler(vcrVoice_PhraseFinish); } public void Stop() { _vcrVoice.Deactivate(); } #endregion // ****************************************** // *** TELECOMMANDE // ****************************************** /// <summary> /// Gestion de l'action /// </summary> /// <param name="flags"></param> /// <param name="beginhi"></param> /// <param name="beginlo"></param> /// <param name="endhi"></param> /// <param name="endlo"></param> /// <param name="Phrase"></param> /// <param name="parsed"></param> /// <param name="results"></param> public void vcrVoice_PhraseFinish(int flags, int beginhi, int beginlo, int endhi, int endlo, String Phrase, String parsed, int results) { switch (Phrase) { case "tv down": SendKeys.Send("{DOWN}"); break; case "tv up": SendKeys.Send("{UP}"); break; case "tv left": SendKeys.Send("{LEFT}"); break; case "tv right": SendKeys.Send("{RIGHT}"); break; case "tv enter": SendKeys.Send("{ENTER}"); break; case "tv back": SendKeys.Send("{ESC}"); break; } } } } [/code] If anyone find the enormous error, thanks to tell me. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
[Test] Plugin voice remote controle
Contact us
RSS
Top
Bottom