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); }
public void DisconnectMouse() { mouseSocket.Disconnect(); mouseSocket = null; }
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); } }