Beispiel #1
0
 private void ReqHandler(int state, ulong rid, int err)
 {
     if (ReqList.ContainsKey(rid))
     {
         WSQReq wr = ReqList[rid];
         if (state == 1 && err == 0)
         {
             int    reqState, errCode;
             object ocodes, ofields, otimes, odata;
             odata = wdc.readdata(rid, out ocodes, out ofields, out otimes, out reqState, out errCode);
             if (wr.updateAll)
             {
                 wr.callback(updataReqData(wr.rdata, ocodes, ofields, odata));
             }
             else
             {
                 wr.callback(formatWD(ocodes, ofields, otimes, odata, errCode));
             }
         }
         else if (err != 0)
         {
             WindData wd = new WindData();
             wd.errorCode = err;
             wd.fieldList = new String[] { "ErrorMessage" };
             wd.data      = new String[] { getErrorMsg(err) };
             wr.callback(wd);
         }
     }
     return;
 }
Beispiel #2
0
 private void ReqHandler(int state, ulong rid, int err)
 {
     if (state != 4)
     {
         lock (ReqList)
         {
             if (ReqList.ContainsKey(rid))
             {
                 WSQReq wr = ReqList[rid];
                 if (state == 1 && err == 0)
                 {
                     int    reqState, errCode;
                     object ocodes, ofields, otimes, odata;
                     odata = wdc.readdata(rid, out ocodes, out ofields, out otimes, out reqState, out errCode);
                     if (wr.updateAll)
                     {
                         wr.callback(rid, updataReqData(wr.rdata, ocodes, ofields, odata));
                     }
                     else
                     {
                         wr.callback(rid, formatWD(ocodes, ofields, otimes, odata, errCode));
                     }
                 }
                 else if (err != 0)
                 {
                     WindData wd = new WindData();
                     wd.errorCode = err;
                     wd.fieldList = new String[] { "ErrorMessage" };
                     wd.data      = new String[] { getErrorMsg(err) };
                     wr.callback(rid, wd);
                 }
             }
         }
     }
     else
     {
         ulong LogonID       = rid;
         bool  find_callback = false;
         lock (TradeCallbackList)
         {
             if (TradeCallbackList.ContainsKey(LogonID))
             {
                 find_callback = true;
             }
             else if (TradeCallbackList.ContainsKey(0))
             {
                 find_callback = true;
                 LogonID       = 0;
             }
             if (find_callback)
             {
                 int    reqState, errCode;
                 object ocodes, ofields, otimes, odata;
                 odata = wdc.readdata_trade(LogonID, out ocodes, out ofields, out otimes, out reqState, out errCode);
                 //调用回调函数
                 TradeCallbackList[LogonID](LogonID, formatWD(ocodes, ofields, otimes, odata, errCode));
             }
         }
     }
     return;
 }