/// <summary> /// Initializes the specified rest client. /// </summary> /// <param name="restClient">The rest client.</param> public void init(RestClient restClient) { restServer = new CloverRESTServer("localhost", "8182", "http"); restServer.CloverConnector = connector; listeners.ForEach(listener => restServer.AddCloverConnectorListener(listener)); listeners.Clear(); { try { restServer.Start(); } catch (Exception) { MessageBox.Show("Couldn't open callback listener service. Are you running as administrator?"); } IRestRequest restRequest = new RestRequest("/Status", Method.GET); restClient.ExecuteAsync(restRequest, response => { if (response.StatusCode != HttpStatusCode.OK) { Console.WriteLine(response.ResponseStatus + " : " + response.StatusCode + " : " + response.ErrorMessage); } else { // response is ok, so should process } }); } }
internal void AddListener(ICloverConnectorListener connectorListener) { if (restServer != null) { restServer.AddCloverConnectorListener(connectorListener); } else { listeners.Add(connectorListener); } }