コード例 #1
0
ファイル: SPDefaultHost.cs プロジェクト: gezi322/Inputshare
        internal static void Init(AnonIpcClient client)
        {
            ISLogger.SetLogFileName("InputshareSP_DefaultHost.log");
            ISLogger.Write("Starting SP default host");
            iClient = client;

            outMan = new WindowsOutputManager();
            outMan.Start();

            deskThread = new ActiveDesktopThread();
            deskThread.Invoke(() => { Desktop.SwitchDesktop(Desktop.InputDesktop); });

            outputDeskThread = new ActiveDesktopThread();
            outputDeskThread.Invoke(() => { Desktop.SwitchDesktop(Desktop.InputDesktop); });

            hWindow = new HookWindow("SPDesktopWatcher");
            hWindow.InitWindow();

            hWindow.InstallDesktopMonitor();
            hWindow.DesktopSwitchEvent += HWindow_DesktopSwitchEvent;

            iClient.Disconnected  += IClient_Disconnected;
            iClient.InputReceived += IClient_InputReceived;

            deskThread.Invoke(() => { GetDisplayConfig(); });
            cursorPosUpdateTimer = new Timer((object o) => { CheckCursorPosition(); }, 0, 0, 50);
            displayCheckTimer    = new Timer((object o) => { CheckForDisplayConfigChange(); }, 0, 0, 1500);
            while (true)
            {
                Thread.Sleep(5000);
            }
        }
コード例 #2
0
        public void CreateThread()
        {
            if (outputThread != null)
            {
                ISLogger.Write("Warning: Cannot create output thread: another thread is already running");
                return;
            }

            outputThread      = new Thread(ThreadLoop);
            outputThread.Name = "OutputThread";
            outputQueue       = new BlockingCollection <ISInputData>();
            cancelToken       = new CancellationTokenSource();
            outManager        = new WindowsOutputManager();

            outputThread.Start();
        }