public Patsystem(string Username, string Password , string ApplicationID, string LicenseID , string HostIP, string HostPort, string PriceFeedIP, string PriceFeedPort, string path) { OnLog("初始 patsystem start"); int ret; ret = ptSetClientPath(path); ret = ptInitialise(ptClient, "v2.8.3", ApplicationID, "", LicenseID, false); ret = ptSetInternetUser('0'); ret = ptSetHostAddress(HostIP, HostPort); ret = ptSetPriceAddress(PriceFeedIP, PriceFeedPort); ret = ptEnable(0); LogonStatusHandler = new ProcAddr(LogonStatus); ForcedLogoutHandler = new ProcAddr(ForcedLogout); DataDLCompleteHandler = new ProcAddr(DataDLComplete); HostLinkProcAddrHandler = new LinkProcAddr(HostLinkStateChange); PriceLinkProcAddrHandler = new LinkProcAddr(PriceLinkStateChange); PriceProcAddrHandler = new PriceProcAddr(PriceUpdate); TickerUpdateProcAddrHandler = new TickerUpdateProcAddr(Ticker); SettlementProcAddrHandler = new SettlementProcAddr(SettlementPrice); ret = ptRegisterLinkStateCallback(ptHostLinkStateChange, HostLinkProcAddrHandler); ret = ptRegisterLinkStateCallback(ptPriceLinkStateChange, PriceLinkProcAddrHandler); ret = ptRegisterCallback(ptLogonStatus, LogonStatusHandler); ret = ptRegisterCallback(ptForcedLogout, ForcedLogoutHandler); ret = ptRegisterCallback(ptDataDLComplete, DataDLCompleteHandler); ret = ptRegisterSettlementCallback(ptSettlementCallback, SettlementProcAddrHandler); ret = ptRegisterTickerCallback(ptTickerUpdate, TickerUpdateProcAddrHandler); ret = ptRegisterPriceCallback(ptPriceUpdate, PriceProcAddrHandler); _LogonDetails = new LogonStruct(); /* strcpy( LogonDetails.UserID,"APPID_007"); * strcpy( LogonDetails.Password,"NC7Ruwk8Ty");*/ _LogonDetails.UserID = Username.PadRight(256, '\0'); _LogonDetails.Password = Password.PadRight(256, '\0'); _LogonDetails.NewPassword = "".PadRight(256, '\0'); _LogonDetails.Reports = 'N'; _LogonDetails.Reset = 'N'; _LogonDetails.OTPassword = "".PadRight(21, '\0'); PriceLink = new QueuePoolByLock <bool>(1); PriceLink.ParameterExcute += new QueuePoolByLock <bool> .ParameterHandler(PriceLink_ParameterExcute); PriceLink.Go(); OnLog("初始 patsystem end"); }
public static extern int ptRegisterCallback(int callbackID, ProcAddr CBackProc);