示例#1
0
        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;
            }
        }
示例#2
0
        public MainWindowViewModel()
        {
            Current = this;

            CursorIconWatcher           = new CursorIconWatcher(Conductor);
            CursorIconWatcher.OnChange += CursorIconWatcher_OnChange;

            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.SessionIDChanged    += SessionIDChanged;
            Conductor.ViewerRemoved       += ViewerRemoved;
            Conductor.ViewerAdded         += ViewerAdded;
            Conductor.ScreenCastRequested += ScreenCastRequested;
        }