Call SwitchToInputDesktop on startup. Additional logging.

This commit is contained in:
Jared Goodwin 2020-08-26 15:34:06 -07:00
parent dc4d88dfb5
commit 84803c324e
3 changed files with 19 additions and 2 deletions

View File

@ -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)

View File

@ -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
{

View File

@ -20,6 +20,7 @@ namespace Remotely.Desktop.Win.Services
await casterSocket.DisconnectAllViewers();
System.Windows.Forms.Application.Exit();
App.Current.Shutdown();
Environment.Exit(0);
}
}
}