Ejemplo n.º 1
0
        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
                    }
                });

            }
        }
Ejemplo n.º 2
0
 internal void Shutdown()
 {
     try
     {
         restServer.Stop();
         restServer = null;
     }
     catch(Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }