示例#1
0
        public void AddZeroAndNonZero()
        {
            frameCounter = 0;
            using (ApplicationInterfaceClient devEnvClient = CreateSession(new Callback(this)))
            {
                Thread.Sleep(TimeSpan.FromSeconds(10));

                Process devEnvProcess = Process.GetProcessesByName("devenv").FirstOrDefault();
                Assert.IsNotNull(devEnvProcess);

                devEnvClient.AddWindowHandleToSession(devEnvProcess.MainWindowHandle);

                using (ApplicationInterfaceClient client = CreateSession(new Callback(this)))
                {
                    Thread.Sleep(TimeSpan.FromSeconds(10));
                    client.AddWindowHandleToSession(IntPtr.Zero);

                    Assert.AreEqual(0, frameCounter);

                    InputProviderManager.applicationService.DispatchFrame(CreateNewFrameArguments(new Point(1, 1)));

                    Thread.Sleep(TimeSpan.FromSeconds(20));

                    Assert.AreEqual(2, frameCounter);

                    client.RemoveSession();
                }

                devEnvClient.RemoveSession();
            }
        }
示例#2
0
        public void AddZeroAndZero()
        {
            frameCounter = 0;
            using (ApplicationInterfaceClient client1 = CreateSession(new Callback(this)))
            {
                Thread.Sleep(TimeSpan.FromSeconds(10));

                client1.AddWindowHandleToSession(IntPtr.Zero);
                client1.SendEmptyFrames(true);

                using (ApplicationInterfaceClient client2 = CreateSession(new Callback(this)))
                {
                    Thread.Sleep(TimeSpan.FromSeconds(10));
                    client2.AddWindowHandleToSession(IntPtr.Zero);
                    client2.SendEmptyFrames(true);
                    Assert.AreEqual(0, frameCounter);

                    InputProviderManager.applicationService.DispatchFrame(CreateNewFrameArguments(new Point(1, 1)));

                    Thread.Sleep(TimeSpan.FromSeconds(20));

                    Assert.AreEqual(2, frameCounter);

                    client2.RemoveSession();
                }

                client1.RemoveSession();
            }
        }