public async Task Init() { SessionID = "Retrieving..."; Config = Config.GetConfig(); if (AllowHostChange) { while (string.IsNullOrWhiteSpace(Config.Host)) { Config.Host = "https://"; PromptForHostName(); } } else { Config.Host = ForceHost; } Conductor.ProcessArgs(new string[] { "-mode", "Normal", "-host", Config.Host }); try { await Conductor.Connect(); } catch (Exception ex) { Logger.Write(ex); MessageBox.Show("Failed to connect to server.", "Connection Failed", MessageBoxButton.OK, MessageBoxImage.Warning); return; } Conductor.SetMessageHandlers(new WinInput()); await Conductor.OutgoingMessages.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName); await Conductor.OutgoingMessages.GetSessionID(); }
private static void StartScreenCasting() { CursorIconWatcher = Services.GetRequiredService <CursorIconWatcher>(); Conductor.Connect().ContinueWith(async(task) => { await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); if (Win32Interop.GetCurrentDesktop(out var currentDesktopName)) { Logger.Write($"Setting initial desktop to {currentDesktopName}."); if (Win32Interop.SwitchToInputDesktop()) { CurrentDesktopName = currentDesktopName; } else { Logger.Write("Failed to set initial desktop."); } } else { Logger.Write("Failed to get initial desktop name."); } await CheckForRelaunch(); Services.GetRequiredService <IdleTimer>().Start(); CursorIconWatcher.OnChange += CursorIconWatcher_OnChange; Services.GetRequiredService <IClipboardService>().BeginWatching(); }); Thread.Sleep(Timeout.Infinite); }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Conductor = new Conductor(); Conductor.ProcessArgs(args); Conductor.Connect().ContinueWith(async(task) => { Conductor.SetMessageHandlers(new X11Input()); Conductor.ScreenCastInitiated += ScreenCastInitiated; Conductor.ClipboardTransferred += Conductor_ClipboardTransferred; await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); await Conductor.CasterSocket.NotifyRequesterUnattendedReady(Conductor.RequesterID); Conductor.IdleTimer = new IdleTimer(Conductor.Viewers); Conductor.IdleTimer.Start(); }); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Conductor = new Conductor(); Conductor.ProcessArgs(args); Conductor.ScreenCastInitiated += ScreenCastInitiated; Conductor.AudioToggled += AudioToggled; Conductor.ClipboardTransferred += Conductor_ClipboardTransferred; Conductor.Connect().ContinueWith(async(task) => { Conductor.SetMessageHandlers(new WinInput()); AudioCapturer = new AudioCapturer(Conductor); CursorIconWatcher = new CursorIconWatcher(Conductor); CursorIconWatcher.OnChange += CursorIconWatcher_OnChange; await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); CheckInitialDesktop(); await CheckForRelaunch(); Conductor.IdleTimer = new IdleTimer(Conductor.Viewers); Conductor.IdleTimer.Start(); await HandleConnection(Conductor); }); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; BuildServices(); Conductor = Services.GetRequiredService <Conductor>(); Conductor.ProcessArgs(args); if (Conductor.Mode == Core.Enums.AppMode.Chat) { Services.GetRequiredService <ChatHostService>().StartChat(Conductor.RequesterID).Wait(); } else { Conductor.Connect().ContinueWith(async(task) => { await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); await Conductor.CasterSocket.NotifyRequesterUnattendedReady(Conductor.RequesterID); Services.GetRequiredService <IdleTimer>().Start(); }); } Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Conductor = new Conductor(); Conductor.ProcessArgs(args); Conductor.Connect().Wait(); Conductor.SetMessageHandlers(new WinInput()); Conductor.ScreenCastInitiated += ScreenCastInitiated; AudioCapturer = new AudioCapturer(Conductor); CursorIconWatcher = new CursorIconWatcher(Conductor); CursorIconWatcher.OnChange += CursorIconWatcher_OnChange; Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName).Wait(); CheckInitialDesktop(); CheckForRelaunch(); Conductor.StartWaitForViewerTimer(); HandleConnection(Conductor).Wait(); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; CursorIconWatcher = new CursorIconWatcher(Conductor); var screenCaster = new WinScreenCaster(CursorIconWatcher); var clipboardService = new WinClipboardService(); clipboardService.BeginWatching(); var casterSocket = new CasterSocket(new WinInput(), screenCaster, new WinAudioCapturer(), clipboardService); Conductor = new Conductor(casterSocket, screenCaster); Conductor.ProcessArgs(args); Conductor.Connect().ContinueWith(async(task) => { CursorIconWatcher.OnChange += CursorIconWatcher_OnChange; await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); CheckInitialDesktop(); await CheckForRelaunch(); Conductor.IdleTimer = new IdleTimer(Conductor.Viewers); Conductor.IdleTimer.Start(); await HandleConnection(Conductor); }); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var screenCaster = new LinuxScreenCaster(); var casterSocket = new CasterSocket(new X11Input(), screenCaster, new LinuxAudioCapturer(), new LinuxClipboardService()); Conductor = new Conductor(casterSocket, screenCaster); Conductor.ProcessArgs(args); Conductor.Connect().ContinueWith(async(task) => { await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID); await Conductor.CasterSocket.NotifyRequesterUnattendedReady(Conductor.RequesterID); Conductor.IdleTimer = new IdleTimer(Conductor.Viewers); Conductor.IdleTimer.Start(); }); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Logger.Write(ex); throw; } }
public static void Main(string[] args) { try { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Conductor = new Conductor(); Conductor.ProcessArgs(args); Conductor.Connect().Wait(); Conductor.SetMessageHandlers(new X11Input(Display)); Conductor.ScreenCastInitiated += ScreenCastInitiated; Conductor.OutgoingMessages.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName).Wait(); Conductor.OutgoingMessages.NotifyRequesterUnattendedReady(Conductor.RequesterID).Wait(); Conductor.StartWaitForViewerTimer(); while (true) { System.Threading.Thread.Sleep(100); } } catch (Exception ex) { Logger.Write(ex); throw; } }