Skip to content

Commit

Permalink
Show all connected devices in the status bar (#1888)
Browse files Browse the repository at this point in the history
* Initial implementation

* Refactor to a new event handler

* Pass along event args

* Go to a cascading menu, remove status icon

* Tweak sim status label

* Remove tooltip

* Fix variable name for consistency

* Update ProjectMessages/ProjectMessages.de.resx

Co-authored-by: Sebastian M <[email protected]>

---------

Co-authored-by: Sebastian M <[email protected]>
  • Loading branch information
neilenns and DocMoebiuz authored Jan 5, 2025
1 parent 15c8ccb commit 694f418
Show file tree
Hide file tree
Showing 8 changed files with 859 additions and 667 deletions.
12 changes: 10 additions & 2 deletions MobiFlight/ExecutionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ExecutionManager
public event EventHandler OnModuleCacheAvailable;
public event EventHandler OnShutdown;
public event EventHandler OnInitialModuleLookupFinished;
public event EventHandler OnJoystickConnectedFinished;
public event EventHandler OnMidiBoardConnectedFinished;

/// <summary>
/// a semaphore to prevent multiple execution of timer callback
Expand Down Expand Up @@ -142,14 +144,20 @@ public ExecutionManager(DataGridView dataGridViewConfig, DataGridView inputsData
#endif
joystickManager.SetHandle(handle);
joystickManager.OnButtonPressed += new ButtonEventHandler(mobiFlightCache_OnButtonPressed);
joystickManager.Connected += (o, e) => { joystickManager.Startup(); };
joystickManager.Connected += (sender, e) => {
joystickManager.Startup();
OnJoystickConnectedFinished?.Invoke(sender, e);
};
if (Properties.Settings.Default.EnableJoystickSupport)
{
joystickManager.Connect();
}

midiBoardManager.OnButtonPressed += new ButtonEventHandler(mobiFlightCache_OnButtonPressed);
midiBoardManager.Connected += (o, e) => { midiBoardManager.Startup(); };
midiBoardManager.Connected += (sender, e) => {
midiBoardManager.Startup();
OnMidiBoardConnectedFinished?.Invoke(sender, e);
};
if (Properties.Settings.Default.EnableMidiSupport)
{
midiBoardManager.Connect();
Expand Down
9 changes: 9 additions & 0 deletions ProjectMessages/ProjectMessages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ProjectMessages/ProjectMessages.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,7 @@ Tip: Save the file after opening to update the associated board for future use.<

Schließe MSFS und führe die Installation erneut aus: "Extras" &gt; "Microsoft Flight Simulator" &gt; "Install WASM module".</value>
</data>
<data name="uiNone" xml:space="preserve">
<value>Keine</value>
</data>
</root>
4 changes: 4 additions & 0 deletions ProjectMessages/ProjectMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,8 @@ Tip: Save the file after opening to update the associated board for future use.<

Close MSFS and install the WASM module via menu "Extras" &gt; "Microsoft Flight Simulator" &gt; "Install WASM module"</value>
</data>
<data name="uiNone" xml:space="preserve">
<value>None</value>
<comment>Used in the connected devices menu to indicate no connected devices found.</comment>
</data>
</root>
116 changes: 79 additions & 37 deletions UI/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 694f418

Please sign in to comment.