Jump to content
LaunchBox Community Forums

[Dev] Using IBigBoxThemeElementPlugin interface


Recommended Posts

I am trying to create a DOFLinx plugin for BigBox. I aim to show LEDs animation, change marquee (game and platform) on DMDs, based on events from BigBox.
To do that, I need to react to platform change, game selection change, and also Up/Down/Right/Left/Enter events (to display animations for those).

I see 2 possibilities :

- Use IBigBoxThemeElementPlugin interface

- Use ISystemEventsPlugin interface

ISystemEventsPlugin interface works : when I launch launchbox or bigbox, with the plugin in Launchbox/plugins folder, I can attach the debugger and add breakpoints in my methods and see what is happening. I can use OnEventRaised, then fetch current platform (GetSelectedPlatform()) and game (GetAllSelectedGames()). But I'm halfway where I want to be : I cannot react to up/down and other events.

Unfortunately, I cannot seem to be able to implement IBigBoxThemeElementPlugin interface. I mean, when I attach the debugger and add breakpoints to OnSelectionChanged or OnUp/OnDown, I never reach the code.

What am I doing wrong? Do I have to modify the theme also?

Thanks!
 

// Reference documentation : https://pluginapi.launchbox-app.com/html/4cf923f7-940c-5735-83de-04107a6ae0e6.htm
namespace DOFConnect
{
    using Unbroken.LaunchBox.Plugins;
    using Unbroken.LaunchBox.Plugins.Data;

    public abstract class BigBoxThemeElement : IBigBoxThemeElementPlugin
    {
        public void OnSelectionChanged(FilterType filterType, string filterValue, IPlatform platform, IPlatformCategory category, IPlaylist playlist, IGame game)
        {
			// This is never reached
            string gameName = game.Title;
            string platformName = platform.Name;
            string gamePlatform = game.Platform;
        }

        public bool OnDown(bool held)
        {
			// This is never reached
            bool isHeld = held;
            return isHeld;
        }
        public abstract bool OnEnter();
        public abstract bool OnEscape();
        public abstract bool OnLeft(bool held);
        public abstract bool OnPageDown();
        public abstract bool OnPageUp();
        public abstract bool OnRight(bool held);
        public abstract bool OnUp(bool held);
    }
}

 

Link to comment
Share on other sites

First off, it sounds like you're attempting to do what our LEDBlinky integration/app already does. I'd look into that app first and see if it does what you are looking to do. I've not used it much but the end goal you described sounds exactly like what that app already does.

Secondly, the BigBoxThemeElement interface needs implemented on a custom WPF theme control that gets added into the view of the theme you are using. If the control isn't in the theme you won't hit those break points.

Link to comment
Share on other sites

Thanks! I looked at LED Blinky but afaik, it does not aim to also display marquees. And also DOFLinx does something new: add events when playing mame games. This allows to display score on another screen (Dot Matrix Display), picture or gif (on events). It also supports everything that direct output framework (DOF) supports. LEDs, solenoids, flash lights, fan blowers, …

for the BigBoxElement interface, should I understand that I cannot use it outside of creating my own theme? Do I have other options?

thanks for everything. I love bigBox. 

Link to comment
Share on other sites

You don't need to create your own Theme to get IBigBoxThemeElementPlugin to work.  But you would need to modify the BigBox theme's Views files.  It's just a matter adding 2 lines.

In the corresponding Views file(s), you need to declare a reference to your project

xmlns:myDofLinx="clr-namespace:DOFConnect;assembly=DOFConnect"

And then somewhere in there, reference that to your class or User Control.

<myDofLinx:BigBoxThemeElement />

 

 

Alternately, depending on how you plan to use it, you could make use of SharpDX to capture controller inputs.  Initialize the Controller and then a Thread that monitors the controllers State.

 

You mentioned OnSelectionChanged , there is the OnEventRaised(string eventType) - eventType == "SelectionChanged".  It's not as robust as the one in IBigBoxThemeElementPlugin. But you can still get that other information (game, platform etc.) by other means.

Link to comment
Share on other sites

Quote

You mentioned OnSelectionChanged , there is the OnEventRaised(string eventType) - eventType == "SelectionChanged".  It's not as robust as the one in IBigBoxThemeElementPlugin. But you can still get that other information (game, platform etc.) by other means.

Yes, this is what I have working at this time. It looks like modifying the theme and get IBigBoxThemeElementPlugin to work may be more robust and offer me what I am after.
The SharpDX way is a nice option too, I may try this if I find the IBigBoxThemeElementPlugin not what I want.

Thank you for everything.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...