示例#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();
            }
        }
示例#3
0
        internal static ApplicationInterfaceClient CreateSession(IApplicationInterfaceCallback callback)
        {
            Uri                 serviceAddress   = new Uri("net.pipe://localhost/Multitouch.Service/ApplicationInterface");
            EndpointAddress     remoteAddress    = new EndpointAddress(serviceAddress);
            NetNamedPipeBinding namedPipeBinding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);

            namedPipeBinding.MaxReceivedMessageSize      = int.MaxValue;
            namedPipeBinding.MaxBufferSize               = int.MaxValue;
            namedPipeBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;

            ApplicationInterfaceClient session = new ApplicationInterfaceClient(new InstanceContext(callback), namedPipeBinding, remoteAddress);

            session.CreateSession();
            return(session);
        }
		internal static ApplicationInterfaceClient CreateSession(IApplicationInterfaceCallback callback)
		{
			Uri serviceAddress = new Uri("net.pipe://localhost/Multitouch.Service/ApplicationInterface");
			EndpointAddress remoteAddress = new EndpointAddress(serviceAddress);
			NetNamedPipeBinding namedPipeBinding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
			namedPipeBinding.MaxReceivedMessageSize = int.MaxValue;
			namedPipeBinding.MaxBufferSize = int.MaxValue;
			namedPipeBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;

			ApplicationInterfaceClient session = new ApplicationInterfaceClient(new InstanceContext(callback), namedPipeBinding, remoteAddress);
			session.CreateSession();
			return session;
		}