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
WinLIRC Plugin (outdated)
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="htpcNoob" data-source="post: 14683" data-attributes="member: 11157"><p>I've actually been using a custom modded version of your winlirc plugin for a while now. It included the GUIWindowManager fix as well as repeat gap instead of timed gap. I also added an extra feature to allow one exclusive button to prompt the user to shutdown MediaPortal. To accomplish this I added a function to the WinLIRCReciever source similar to what is invoked when the X is pressed in the topbar plugin:</p><p></p><p>[code]</p><p> private void WinLircShutdownManager()</p><p> {</p><p> Log.Write(" WinLIRC: ShutdownManager Activated!");</p><p> if (GUIWindowManager.ActiveWindow != (int)GUIWindow.Window.WINDOW_HOME)</p><p> {</p><p> Log.Write(" WinLIRC: ShutdownManager Aborted - Not at HOME!");</p><p> return;</p><p> }</p><p></p><p> // Show shutdown/exit dialog</p><p> GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ASKYESNO,0,0,0,0,0,0);</p><p> msg.Param1=631;</p><p> msg.Param2=0;</p><p> msg.Param3=0;</p><p> GUIWindowManager.SendMessage(msg);</p><p> if (msg.Param1 != 1)</p><p> {</p><p> return;</p><p> }</p><p> </p><p> // Shutdown players</p><p> MediaPortal.Player.g_Player.Stop();</p><p></p><p> // Ask all plugins to see if we can shutdown</p><p> ArrayList wakeables = PluginManager.WakeablePlugins;</p><p> foreach (IWakeable wakeable in wakeables)</p><p> {</p><p> if (wakeable.DisallowShutdown())</p><p> {</p><p> Log.Write(" WinLIRC: ShutdownManager Aborted by module/plugin - {0}", wakeable.PluginName());</p><p> return;</p><p> }</p><p> }</p><p></p><p> Log.Write(" WinLIRC: ShutdownManager - Hibernating!");</p><p></p><p> /*</p><p> LogOff = 0</p><p> PowerOff = 1</p><p> Reboot = 2</p><p> ShutDown = 3 (DEFAULT)</p><p> Suspend = 4</p><p> Hibernate = 5</p><p> */</p><p> RestartOptions tempRO;</p><p> switch(shutdownType)</p><p> {</p><p> case 0:</p><p> tempRO = RestartOptions.LogOff;</p><p> break;</p><p> case 1:</p><p> tempRO = RestartOptions.PowerOff;</p><p> break;</p><p> case 2:</p><p> tempRO = RestartOptions.Reboot;</p><p> break;</p><p> case 4:</p><p> tempRO = RestartOptions.Suspend;</p><p> break;</p><p> case 5:</p><p> tempRO = RestartOptions.Hibernate;</p><p> break;</p><p> default:</p><p> tempRO = RestartOptions.ShutDown;</p><p> break;</p><p> }</p><p> WindowsController.ExitWindows(tempRO, false);</p><p> }</p><p>[/code]</p><p></p><p>This prompted me with a GUI asking whether I wanted to shutdown or not. If i select yes, then it will GRACEFULLY shutdown MediaPortal (actually in my case, it was Hibernate) .</p><p></p><p>To invoke the method, I added code within processWinLIRCCommand(...) to check if the button being pressed was the one to shutdown. If it was, I checked to make sure that the repeat count equaled a specific value (= and NOT <>).</p><p></p><p>[code]</p><p> // Check if the shutdown command button is being pressed. if it is</p><p> // for a specific number of repeat count, call WinLircShutdownManager</p><p> // and exit the function</p><p> if(command.sCommand == shutdownCommandButton)</p><p> {</p><p> // Only invoke this ONCE and dont let it repeat</p><p> if(command.iRepeat == shutdownGapRepeat)</p><p> {</p><p> WinLircShutdownManager();</p><p> }</p><p> return;</p><p> }</p><p>[/code]</p><p></p><p>Since this was my own mod, I didnt create any settings options and basically hardcoded the values for shutdownCommandButton, shutdownGapRepeat and shutdownType.</p><p></p><p>Just thought I'd share.</p></blockquote><p></p>
[QUOTE="htpcNoob, post: 14683, member: 11157"] I've actually been using a custom modded version of your winlirc plugin for a while now. It included the GUIWindowManager fix as well as repeat gap instead of timed gap. I also added an extra feature to allow one exclusive button to prompt the user to shutdown MediaPortal. To accomplish this I added a function to the WinLIRCReciever source similar to what is invoked when the X is pressed in the topbar plugin: [code] private void WinLircShutdownManager() { Log.Write(" WinLIRC: ShutdownManager Activated!"); if (GUIWindowManager.ActiveWindow != (int)GUIWindow.Window.WINDOW_HOME) { Log.Write(" WinLIRC: ShutdownManager Aborted - Not at HOME!"); return; } // Show shutdown/exit dialog GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ASKYESNO,0,0,0,0,0,0); msg.Param1=631; msg.Param2=0; msg.Param3=0; GUIWindowManager.SendMessage(msg); if (msg.Param1 != 1) { return; } // Shutdown players MediaPortal.Player.g_Player.Stop(); // Ask all plugins to see if we can shutdown ArrayList wakeables = PluginManager.WakeablePlugins; foreach (IWakeable wakeable in wakeables) { if (wakeable.DisallowShutdown()) { Log.Write(" WinLIRC: ShutdownManager Aborted by module/plugin - {0}", wakeable.PluginName()); return; } } Log.Write(" WinLIRC: ShutdownManager - Hibernating!"); /* LogOff = 0 PowerOff = 1 Reboot = 2 ShutDown = 3 (DEFAULT) Suspend = 4 Hibernate = 5 */ RestartOptions tempRO; switch(shutdownType) { case 0: tempRO = RestartOptions.LogOff; break; case 1: tempRO = RestartOptions.PowerOff; break; case 2: tempRO = RestartOptions.Reboot; break; case 4: tempRO = RestartOptions.Suspend; break; case 5: tempRO = RestartOptions.Hibernate; break; default: tempRO = RestartOptions.ShutDown; break; } WindowsController.ExitWindows(tempRO, false); } [/code] This prompted me with a GUI asking whether I wanted to shutdown or not. If i select yes, then it will GRACEFULLY shutdown MediaPortal (actually in my case, it was Hibernate) . To invoke the method, I added code within processWinLIRCCommand(...) to check if the button being pressed was the one to shutdown. If it was, I checked to make sure that the repeat count equaled a specific value (= and NOT <>). [code] // Check if the shutdown command button is being pressed. if it is // for a specific number of repeat count, call WinLircShutdownManager // and exit the function if(command.sCommand == shutdownCommandButton) { // Only invoke this ONCE and dont let it repeat if(command.iRepeat == shutdownGapRepeat) { WinLircShutdownManager(); } return; } [/code] Since this was my own mod, I didnt create any settings options and basically hardcoded the values for shutdownCommandButton, shutdownGapRepeat and shutdownType. Just thought I'd share. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
WinLIRC Plugin (outdated)
Contact us
RSS
Top
Bottom