I have to add a delay to get this simple program to work:
class Program : CloverConnectorListener
{
CloverDeviceConfiguration cloverDeviceConfiguration;
CloverConnector cloverConnector;
Program()
{
cloverDeviceConfiguration = new TestCloverDeviceConfiguration();
cloverConnector = new CloverConnector(cloverDeviceConfiguration);
cloverConnector.AddCloverConnectorListener(this);
**Thread.Sleep(5000);**
}
public int Sale(long amount) {
SaleRequest saleRequest = new SaleRequest();
saleRequest.Amount = amount;
return cloverConnector.Sale(saleRequest);
}
static void Main(string[] args)
{
Console.WriteLine(new Program().Sale(7500));
Console.ReadKey();
}
See the bolded Thread.Sleep() for 5 seconds after creating the Connector and adding myself as a listener? If I take that out, calling Sale() simply returns -1 and nothing happens: no call to OnSaleResponse() in my listener. But nothing else is being called in the listener as far as I can tell. What do I need to do to get properly set up so that Sale() works without the delay?