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; }
public ulong wsqtd(string windCodes, string fields, string options, WindCallback wc, bool updateAll = true) { checkConnection(); if (wc == null) { throw new Exception("订阅回调函数不能为空。"); } string tmpoptions = options + ";REALTIME=Y"; int errCode; ulong rid = wdc.wsqtd(windCodes, fields, tmpoptions, out errCode); WSQReq wr = new WSQReq(); wr.callback = wc; wr.rdata = wsqtd(windCodes, fields, options); wr.updateAll = updateAll; ReqList.Add(rid, wr); return(rid); }
public ulong bbq(ref int errCode, string windCodes, string fields, string options, WindCallback wc) { checkConnection(); if (wc == null) { throw new Exception("订阅回调函数不能为空。"); } string tmpoptions = options + ";REALTIME=Y"; ulong rid = wdc.bbq(windCodes, fields, tmpoptions, out errCode); WSQReq wr = new WSQReq(); wr.callback = wc; wr.updateAll = false; lock (ReqList) { ReqList.Add(rid, wr); } return(rid); }
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; }
public ulong wsqtd(string windCodes, string fields, string options, WindCallback wc, bool updateAll = true) { checkConnection(); if (wc == null) { throw new Exception("订阅回调函数不能为空。"); } string tmpoptions = options + ";REALTIME=Y"; int errCode; ulong rid = wdc.wsqtd(windCodes, fields, tmpoptions, out errCode); WSQReq wr = new WSQReq(); wr.callback = wc; wr.rdata = wsqtd(windCodes, fields, options); wr.updateAll = updateAll; ReqList.Add(rid, wr); return rid; }