Ejemplo n.º 1
0
        /**
         * 点击事件
         **/
        public static void InputEvent(Int32 port, MouseEventType type)
        {
            TSocket socket = new TSocket("127.0.0.1", port, 1000);

            TFramedTransport.Factory factory = new
                                               TFramedTransport.Factory();
            TTransport transport = factory.GetTransport(socket);

            TBinaryProtocol.Factory factory1 =
                new TBinaryProtocol.Factory();
            TProtocol            protocol = factory1.GetProtocol(transport);
            TMultiplexedProtocol impl1
                = new TMultiplexedProtocol(protocol, "ScreenService");

            ScreenService.Client client =
                new ScreenService.Client(impl1);
            try
            {
                socket.Open();
                bool r
                    = client.InputEvent(type);
            }
            catch (Exception x)
            {
                Console.WriteLine(x.StackTrace);
            }
            finally
            {
                transport.Close();
            }
        }
Ejemplo n.º 2
0
        /**
         * 获取手机屏幕分辨率
         **/
        public static String sendPoint(Int32 port, Int32 x, Int32 y)
        {
            TSocket socket = new TSocket("127.0.0.1", port, 1000);

            TFramedTransport.Factory factory = new
                                               TFramedTransport.Factory();
            TTransport transport = factory.GetTransport(socket);

            TBinaryProtocol.Factory factory1 =
                new TBinaryProtocol.Factory();
            TProtocol            protocol = factory1.GetProtocol(transport);
            TMultiplexedProtocol impl1
                = new TMultiplexedProtocol(protocol, "ScreenService");

            ScreenService.Client client =
                new ScreenService.Client(impl1);
            try
            {
                socket.Open();
                return(client.sendPoint(x, y));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
            finally
            {
                transport.Close();
            }
            return("");
        }