Add desktop discovery responder
This commit is contained in:
@@ -6,6 +6,7 @@ public sealed class TrayApplicationContext : ApplicationContext
|
||||
{
|
||||
private readonly KeyboardInjectionService keyboard;
|
||||
private readonly WebSocketServerService server;
|
||||
private readonly DiscoveryResponderService discovery;
|
||||
private readonly NotifyIcon notifyIcon;
|
||||
private ToolStripMenuItem? clipboardPasteMenuItem;
|
||||
private ToolStripMenuItem? sendInputTypingMenuItem;
|
||||
@@ -18,6 +19,7 @@ public sealed class TrayApplicationContext : ApplicationContext
|
||||
|
||||
server = new WebSocketServerService(handler);
|
||||
server.StatusChanged += (_, _) => UpdateTrayText();
|
||||
discovery = new DiscoveryResponderService(() => server.LocalIpAddress, () => server.Port);
|
||||
|
||||
notifyIcon = new NotifyIcon
|
||||
{
|
||||
@@ -31,6 +33,7 @@ public sealed class TrayApplicationContext : ApplicationContext
|
||||
try
|
||||
{
|
||||
server.Start(8181);
|
||||
discovery.Start();
|
||||
UpdateTrayText();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -47,6 +50,7 @@ public sealed class TrayApplicationContext : ApplicationContext
|
||||
if (disposing)
|
||||
{
|
||||
notifyIcon.Dispose();
|
||||
discovery.Dispose();
|
||||
server.Dispose();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user