Jump to content
LaunchBox Community Forums

SelectionChanged system event not firing when you exit a game wheel


Recommended Posts

I'm writing a plugin to update an led matrix with platform and game info when scrolling through both the platforms wheel and game wheels.

I'm using SystemEventTypes.SelectionChanged to do this which works perfectly except for one case. When you are in a game wheel and exit to the platform wheel, the SelectionChanged event does not fire. It will fire if you scroll to a new platform, but not if you just stay on the platform you exited.

Also, when you are in that state, calling GetAllSelectedGames shows that the last game from when you were in that game wheel is still selected. So I can't even do something like a timer to periodically check for that condition.

Any suggestions on how to catch game wheel exit from within a plugin?

Link to comment
Share on other sites

I ran into the same issue (SelectionChanged) a few years ago when I was 1st working with the API.  Granted I was attempting to learn C# at the same time as leaning what an "API" is.  (Probably not a good combo. lol)  😊 

At a later time, I worked on a BigBox plugin with @jayjay that allows you to launch a game/application directly from the Platform Wheel View level.  This uses UserControl, IBigBoxThemeElementPlugin.  Unfortunately, you will need to modify your BB Theme Views to catch it.  The good part is it's only adding 2 lines.

The Class would be something like 

namespace MyNameSpace
{
   public partial class MyUserControl : UserControl, IBigBoxThemeElementPlugin
   {
      ....
   }
}

And once IBigBoxThemeElementPlugin is initialized in the class, you can use the method 

public void OnSelectionChanged(FilterType filterType, string filterValue, IPlatform platform, IPlatformCategory category, IPlaylist playlist, IGame game)
{
   //do stuff 
   return, false;
}

This will give you the selected platform and game.  You also have access to OnEnter() and OnEscape() (as well as a few other controls).

 

The 2 added lines in the Views are 

xmlns:JoeWasHere=\"clr-namespace:MyNameSpace;assembly=MyNamespace"

<!-- AND -->

<JoeWasHere:MyUserControl />

 

To be clear, I never pursued SelectionChanged.  So there's a really good chance there's a 'proper' way to use it and make it work for your application. ;)  This is merely "a suggestion on how to catch game wheel exit from within a plugin."  And as I write this out, I realize you need to somehow figure out if you're currently in a platform view or a games view.  May be something in the API or you may need to set a bool inside OnEnter/OnExit???  And maybe I still only 'know enough to be dangerous'. lol

  • Like 1
Link to comment
Share on other sites

Posted (edited)

@JoeViking245 Unsurprisingly, OnSelectionChanged from IBigBoxThemeElementPlugin in the platform view suffers from the exact same issue as the SelectionChanged event from ISystemEventsPlugin. However, putting the theme element plugin in the wheel view and using OnEscape was exactly what I needed.

I just really really hate having to force updates to all the game wheel view xaml files in order to get this working. The selected game not clearing and not triggering SystemEventTypes.SelectionChanged on a game wheel exit really feels like a bug to me.

This at least gets it working though, so thank you very much for the suggestion.

 

Edited by superrob3000
  • 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
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.

 Share

×
×
  • Create New...