コード例 #1
0
		internal void CreateSession()
		{
			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;
			namedPipeBinding.ReceiveTimeout = TimeSpan.MaxValue;

			IApplicationInterfaceCallback dispatcher = new MultitouchServiceContactDispatcher(logic);
			InstanceContext instanceContext = new InstanceContext(dispatcher);
			service = new ApplicationInterfaceClient(instanceContext, namedPipeBinding, remoteAddress);

			try
			{
				service.CreateSession();
				MouseHelper.SingleMouseFallback = false;
			}
			catch (EndpointNotFoundException)
			{
				//throw new MultitouchException("Could not connect to Multitouch service, please start Multitouch input server before running this application.", e);
				Trace.TraceWarning("Could not connect to Multitouch service. Enabling single mouse input.");
				SingleMouseClientAndDispatcher client = new SingleMouseClientAndDispatcher(logic);
				service = client;
				dispatcher = client;
				MouseHelper.SingleMouseFallback = true;
			}
			contactDispatcher = dispatcher;
		}
コード例 #2
0
        internal void CreateSession()
        {
            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;
            namedPipeBinding.ReceiveTimeout              = TimeSpan.MaxValue;

            IApplicationInterfaceCallback dispatcher = new MultitouchServiceContactDispatcher(logic);
            InstanceContext instanceContext          = new InstanceContext(dispatcher);

            service = new ApplicationInterfaceClient(instanceContext, namedPipeBinding, remoteAddress);

            try
            {
                service.CreateSession();
                MouseHelper.SingleMouseFallback = false;
            }
            catch (EndpointNotFoundException)
            {
                //throw new MultitouchException("Could not connect to Multitouch service, please start Multitouch input server before running this application.", e);
                Trace.TraceWarning("Could not connect to Multitouch service. Enabling single mouse input.");
                SingleMouseClientAndDispatcher client = new SingleMouseClientAndDispatcher(logic);
                service    = client;
                dispatcher = client;
                MouseHelper.SingleMouseFallback = true;
            }
            contactDispatcher = dispatcher;
        }