mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Call SwitchToInputDesktop on startup. Additional logging.
This commit is contained in:
parent
dc4d88dfb5
commit
84803c324e
@ -60,6 +60,16 @@ namespace Remotely.Agent.Services
|
||||
|
||||
var procID = await AppLauncher.LaunchChatService(orgName, senderConnectionID, hubConnection);
|
||||
|
||||
if (procID > 0)
|
||||
{
|
||||
Logger.Write($"Chat app started. Process ID: {procID}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Write($"Chat app did not start successfully.");
|
||||
return;
|
||||
}
|
||||
|
||||
var clientPipe = new NamedPipeClientStream(".", "Remotely_Chat" + senderConnectionID, PipeDirection.InOut, PipeOptions.Asynchronous);
|
||||
clientPipe.Connect(15000);
|
||||
if (!clientPipe.IsConnected)
|
||||
|
||||
@ -48,19 +48,25 @@ namespace Remotely.Desktop.Win
|
||||
CasterSocket = Services.GetRequiredService<CasterSocket>();
|
||||
Conductor.ProcessArgs(Environment.GetCommandLineArgs().SkipWhile(x => !x.StartsWith("-")).ToArray());
|
||||
|
||||
Win32Interop.SwitchToInputDesktop();
|
||||
|
||||
if (Conductor.Mode == Core.Enums.AppMode.Chat)
|
||||
{
|
||||
StartUiThread(null);
|
||||
Services.GetRequiredService<IChatHostService>().StartChat(Conductor.RequesterID, Conductor.OrganizationName).Wait();
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var chatService = Services.GetRequiredService<IChatHostService>();
|
||||
await chatService.StartChat(Conductor.RequesterID, Conductor.OrganizationName);
|
||||
});
|
||||
}
|
||||
else if (Conductor.Mode == Core.Enums.AppMode.Unattended)
|
||||
{
|
||||
StartUiThread(null);
|
||||
Task.Run(StartScreenCasting);
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
App.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||
});
|
||||
_ = Task.Run(StartScreenCasting);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -20,6 +20,7 @@ namespace Remotely.Desktop.Win.Services
|
||||
await casterSocket.DisconnectAllViewers();
|
||||
System.Windows.Forms.Application.Exit();
|
||||
App.Current.Shutdown();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user