Skip to content

Commit

Permalink
Merge pull request #138 from dennis/initialize-winformui-subscription…
Browse files Browse the repository at this point in the history
…-earlier

WinFormUI wouldn't always pick up creation events
  • Loading branch information
dennis authored Sep 27, 2021
2 parents 9386df7 + c14c938 commit b737bcf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Use `parse_json(event.Json)` to get a LuaTable with the values as were sent
via the event. Also adds `generate_json(luaTable)` to generate json string from
a Lua table.
- Bugfix: WinFormUI wouldn't always pick up creation events, while it was initializing it's window.


## [0.9.0](https://github.com/dennis/slipstream/releases/tag/v0.9.0) (2021-08-21)
Expand Down
4 changes: 3 additions & 1 deletion Components/WinFormUI/Forms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public MainWindow(
IApplicationVersionService applicationVersionService,
IEventHandlerController eventHandlerController,
IEventSerdeService eventSerdeService,
IEventBusSubscription subscription,
bool deepView
)
{
Expand All @@ -71,6 +72,8 @@ bool deepView
BroadcastEnvelope = new EventEnvelope(instanceId);
DeepView = deepView;

EventBusSubscription = subscription;

InitializeComponent();

EventGridView.Columns.Add("uptime", "Uptime");
Expand Down Expand Up @@ -138,7 +141,6 @@ private void MainWindow_FormClosing(object? sender, FormClosingEventArgs e)

private void MainWindow_Load(object? sender, EventArgs e)
{
EventBusSubscription = EventBus.RegisterListener(InstanceId, fromBeginning: true, promiscuousMode: true);
EventHandlerThreadCancellationToken = EventHandlerThreadCts.Token;
EventHandlerThread = new Thread(new ThreadStart(EventListenerMain))
{
Expand Down
3 changes: 3 additions & 0 deletions Components/WinFormUI/Lua/WinFormUIInstanceThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ IEventSerdeService eventSerdeService
[STAThreadAttribute]
protected override void Main()
{
var subscription = EventBus.RegisterListener(InstanceId, fromBeginning: true, promiscuousMode: true);

Application.Run(new MainWindow(
InstanceId,
this,
Expand All @@ -55,6 +57,7 @@ protected override void Main()
ApplicationVersionService,
EventHandlerController,
EventSerdeService,
subscription,
DeepView
));
}
Expand Down

0 comments on commit b737bcf

Please sign in to comment.