示例#1
0
        public EmsAdapter(EmsSettings settings)
        {
            if (settings != null)
            {
                Settings = settings;
            }
            if (_app == null)
            {
                _app = new TalipcToolkitApp();
            }

            Stats = new Dictionary <string, OrderStats>();

            Service = "ACCOUNT_GATEWAY";
            Topic   = "ORDER";

            // THESE ARE SETTINGS
            GatewayMachine = settings.Gateway;
            Bank           = settings.Bank;
            Branch         = settings.Branch;
            Customer       = settings.Customer;
            Deposit        = settings.Deposit;

            _query                = _app.GetAsyncQuery(GatewayMachine, Service, Topic);
            _query.OnTerminate   += OnTerminate;
            _query.OnOtherAck    += OnOtherAck;
            _query.OnAdviseData  += OnAdviseData;
            _query.OnExecute     += OnExecute;
            _query.OnExecuteAck  += OnExecuteAck;
            _query.OnRequestData += OnRequestData;

            if (!_query.Connect())
            {
                Console.WriteLine("No dice on connection");
            }
            else
            {
                _query.Advise("ORDERS;*;", "TAL4");
                _query.Request("ORDERS;*;", "TAL4");
            }
        }