コード例 #1
0
        public void ConnectMouse()
        {
            var listener = new ResponseListener
                (
                loadEventArg =>
                {
                    JsonObject obj;
                    if (loadEventArg is LoadEventArgs)
                        obj = (loadEventArg as LoadEventArgs).Load.GetPayload() as JsonObject;
                    else obj = (JsonObject)loadEventArg;

                    if (obj != null)
                    {
                        var socketPath = obj.GetNamedString("socketPath");
                        mouseSocket = new WebOstvMouseSocketConnection(socketPath);
                    }
                },
                serviceCommandError =>
                {

                }
                );
            ConnectMouse(listener);
        }
コード例 #2
0
 public void DisconnectMouse()
 {
     mouseSocket.Disconnect();
     mouseSocket = null;
 }
コード例 #3
0
        private void SendSpecialKey(String key, ResponseListener listener)
        {
            if (mouseSocket != null)
            {
                mouseSocket.Button(key);
            }
            else
            {

                var responseListener = new ResponseListener
                (
                    loadEventArg =>
                    {
                        JsonObject obj;
                        if (loadEventArg is LoadEventArgs)
                            obj = (loadEventArg as LoadEventArgs).Load.GetPayload() as JsonObject;
                        else obj = (JsonObject)loadEventArg;

                        if (obj != null)
                        {
                            var socketPath = obj.GetNamedString("socketPath");
                            mouseSocket = new WebOstvMouseSocketConnection(socketPath);
                        }

                        mouseSocket.Button(key);
                        Util.PostSuccess(listener, null);
                    },
                    serviceCommandError =>
                    {
                        Util.PostError(listener, null);
                    }
                );

                ConnectMouse(responseListener);
            }
        }