private static void OnTransaction(IAsyncResult ar)
        {
            object[] os    = (object[])ar.AsyncState;
            string   cname = (string)os[0];
            ACSControllerUtilities _acsu = (ACSControllerUtilities)os[1];
            string queryStr = ACSQueryUtilities.GenACSSimQueryStr(IODataCollection.queryList.Find(cls => cls.name == cname).IOList);

            try
            {
                string     transStr = _acsu.EndTransaction(ar);
                List <int> tl       = ACSQueryUtilities.ConvertACSTransStr(transStr, out bool result);
                if (!result)
                {
                    string err = $"变量名错误或未定义:{cname}@{queryStr}=>{transStr}";
                    IOInterface.updateError = true;
                    RunningTransaction.Remove(cname);
                    IOInterface.ShowError(err);
                    return;
                }
                IODataCollection.UpdateIOQueryList(cname, tl);
                if (!ACSThreadAbort)
                {
                    Thread.Sleep(50);
                    _acsu.BeginTransaction(cname, queryStr, new AsyncCallback(OnTransaction), _acsu);
                }
                else
                {
                    RunningTransaction.Remove(cname);
                    if (RunningTransaction.Count == 0)
                    {
                        ACSThreadAborted = true;
                    }
                }
            }
            catch (Exception e)
            {
                string err = $"{e.Message}:{cname}@{queryStr}";
                IOInterface.updateError = true;
                RunningTransaction.Remove(cname);
                if (RunningTransaction.Count == 0)
                {
                    ACSThreadAborted = true;
                }

                IOInterface.ShowError(err);
            }
            GC.Collect();
        }
Example #2
0
 public void BeginTransaction(string cname, string queryStr, AsyncCallback ac, ACSControllerUtilities _acsu)
 {
     ACSControllerUtilities acsu   = new ACSControllerUtilities(_acsu);
     AsyncTransactionDel    tdel   = new AsyncTransactionDel(Transaction);
     IAsyncResult           result = tdel.BeginInvoke(cname, queryStr, new AsyncCallback(ac), new object[] { cname, acsu });
 }
Example #3
0
 public ACSControllerUtilities(ACSControllerUtilities _acsu)
 {
     aList = new Dictionary <string, Api>(_acsu.aList);
 }