Jump to content
LaunchBox Community Forums

Plugin API Suggestions


Nielk1

Recommended Posts

To start I'd like to just point out the reason this is a topic rather than a BitBucket entry is to allow for discussion of possibilities and suggestions.  Once ideas are sufficiently hashed out they can be added to the BitBucket for proper tracking.  I'll edit this topic opening to add items as needed.

Plugin Types

IMenuPlugin (Fulfilled by ISystemMenuItemPlugin)
Plugin to put options in the top level menus of LaunchBox or the root of BigBox.  An enum could be used to set what menu it appears in.

IGameMenuItemPlugin (Existing)
This plugin type already exists, but it could use a few new features.  Specifically, a way to control if a menu item is visible or disabled in both BB and LB rather than the current behavior.  Additionally, a method to place menu items under other menu items would be helpful.  This could be done through string matching but it might be best to use a new property with a unique GUID in it to make hierarchy lookups very easy.  Access to the MenuItem itself would solve any possible issues but also might not be easily possible given how there's two different menus.  Sub-menus in BigBox could be a modal with a list, similar to the 'Add to Playlist' modal.

IServicePlugin (Fulfilled by ISystemEventsPlugin)
This type of plugin would have very limited interfaces with LaunchBox and BigBox.  The purpose of this plugin type is to be informed of program startup and shutdown so singleton services may be constructed and destructed.  Technically we can construct these singletons on demand when needed and let them sit around, but we can't ensure they are cleaned up properly without knowing that LB/BB wishes to close.  An Interface explicitly for this purpose would allow for services to only be started if in the correct application (LB or BB) through a BigBoxInitalize() and LaunchBoxInitalize() function.

IPlatformPlugin
A virtualized platform that registers with the main interface at startup and allows for pure programmatic language.

IDataImportPlugin
A method to add a datasource to the existing metadata and image finding systems to make use of LB's background working threads.

IBigBoxThemeElementPlugin (Existing)
It would be nice if this interface could be added to the internal observer list if it is added to a view as a Resource instead of a control.  Right now I need to add my data source as a dummy control for the events to fire.

Functions

Navigate(Section, Item)
A navigate function would allow for jumping to a different section of the interface.  Using such a tool one could add a menu option to a game such as "series" which would automatically jump to the view of that series with that game pre-selected.

PluginHelper.BigBoxMainViewModel.ShowList<T>(List<T> items, Action(T) onFinished, string title = null)
A basic list selector.  You'd want to use the default(T) option as a response when no item is selected but instead the back binding is used.  You could also make it explicitly use a List<string> with an action parameter of type int as the index of the selected item.  In the case of the index based action parameter -1 would be triggered by selecting the back button.  The title would be a TextBlock placed in the layout grid cell above the List (which is in the center) and set to center+bottom alignment.  I've done this in my own View injection.

PluginHelper.BigBoxMainViewModel.ShowQuestion(string question, MessageBoxButtons btn, Action(DialogResult) onFinished)
This would mimmic WinForm dialog boxes.  Using the WinForm dialog enum types is possible but customs might be better as it gives you more flexibility.  With a custom set of types you could have ModalButtons.YesNoButtons and ModalButtons.YesNoBinding where the latter uses the forward and back bindings and the latter requires the user to actively position the selector over button Yes or button No.  You could also use a horizontal list of button text strings and return the selected index.

Pluginhelper.BigBoxMainViewModel.ShowNoticeModal(string message, Action(T) onFinished)
Just a very basic model that shows a notice that is cleared by any button press, or possibly only a back button press, many options that could be pushed into the parameters.  You could even make a setting to make it have a special style, such as "Notice", "Warning", "Error", or other that would adjust the colorizing of the modal.

Pluginhelper.BigBoxMainViewModel.ShowCustomModal(ViewModel modelInstance, Action(modelInstance) onFinished)
Give the user full control over the modal.  The Action can be done with no parameters but passing the modal itself along might make it easier for the developer to implement checking of custom properties in that view.

Properties

IGame.ParentPlatform
Possible method to avoid the wasted CPU cycles of performing IDataManager.GetPlatformByName(IGame.Platform).  This is only worth doing if the data relation is already present in the application logic and it can be exposed.

IDataManager.ApplicationType, IDataManager.IsBigBox, IDataManager.IsLaunchBox
If we are in BigBox or LaunchBox.  It might be worth making this an Enum rather than simply a having just IsBigBox and IsLaunchBox as you might have a 3rd application type in the future.

LockedFlag (Fulfilled by IStateManager.IsBigBoxLocked)
A method to see the locked flag to disable functionality if locked.

General

Image Filename Patterns
A method to access the filename logic used in saving/reading images for Platforms and Games.  I know the names can include the game name with some characters removed or replaced, or the game's ID, or some composite and thus it isn't clear what the algorithm in use is.

LB Progress Bar Access
Some sort of task manager that lets us trigger the progress bar for background tasks in LB.  This would need some sort of collection so multiple tasks can be running at once.  In that case you'd probably end up showing %*(1/Count) as the fill % or cycle items.BigBox Modals
It would be nice to have a base class and system to use for BigBox modals.  Right now, the only way I can find to do this is to add an IBigBoxThemeElementPlugin to the theme and somehow trigger it with the IGameMenuItemPlugin, but this is just an idea I've not even tested yet.  In general IGameMenuItemPlugin lacks access to the host view for programmatic injection of controls so edited themes would be a must for full functionality.

LocalDb wrapper
Wrapper for functions in Unbroken.LaunchBox.Search.LocalDb allowing for searching the LocalDb and triggering it to update if it's out of date.  I threw together a plugin using programmatic binding time version redirection to deal with issues, but that's way above what most people can do.

Edited by Nielk1
Added modal dialog requests for bigbox
  • Like 3
Link to comment
Share on other sites

  • 2 months later...

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...