//交易账号登陆 public WindData tlogon(string brokerID, string departmentID, string accountID, string password, string accountType, string options = "", TradeCallback callback = null) { checkConnection(); object ofields, odata; int errCode; if (callback != null) { options += ";PushCallBack=A"; lock (TradeCallbackList) { TradeCallbackList[0] = callback; } } odata = wdc.tLogon(brokerID, departmentID, accountID, password, accountType, options, out ofields, out errCode); WindData retData = formatWD(null, ofields, null, odata, errCode); if (callback != null && retData.errorCode == 0) { lock (TradeCallbackList) { TradeCallbackList.Remove(0); string strLongId = retData.GetLogonId(); ulong LogonID = 0; if ((!string.IsNullOrEmpty(strLongId)) && (LogonID = Convert.ToUInt32(strLongId)) != 0) { TradeCallbackList[LogonID] = callback; } } } return(retData); }
public void OnTradeCallback(TradeCallbackEventArgs e) { if (Trades.ContainsKey(e.Number)) { Trades[e.Number] = e; } else { Trades.Add(e.Number, e); } TradeCallback?.Invoke(this, e); }