private void ReleaseSubscribe() { TradeFacade.Clients().ForEach((client) => { client.PlaceReportReceived -= On_PlaceReportReceived; client.FillReportReceived -= On_FillReportReceived; client.CancelReportReceived -= On_CancelReportReceived; }); }
private void InitSubscirbe() { TradeFacade.Clients().ForEach((client) => { client.PlaceReportReceived += On_PlaceReportReceived; client.FillReportReceived += On_FillReportReceived; client.CancelReportReceived += On_CancelReportReceived; }); }
private void InitAccounts() { string selectedItem = comboAccountNo.Text; comboAccountNo.Items.Clear(); TradeFacade.Accounts().ForEach((item) => { comboAccountNo.Items.Add(item); }); if (comboAccountNo.Items.Count > 0 && string.IsNullOrEmpty(selectedItem)) { comboAccountNo.SelectedIndex = 0; } else { comboAccountNo.SelectedItem = selectedItem; } }
private bool DoLogin() { Config config = CurrentConfig(); string account = CurrentAccount(); if (config == null) { MessageBox.Show("请选择服务配置"); return(false); } if (String.IsNullOrEmpty(account)) { MessageBox.Show("请输入账号"); return(false); } try { SaveConfig(); TradeClient adapter = TradeFacade.Create( account, txtPassword.Text, config.TradeHost, config.TradeQueryPort, config.TradeOrderPort, config.TradeReportPort ); StockFacade.ConnectL1(config.ReferenceAddress); StockFacade.ConnectL2(config.Level2Address); StockFacade.UpdateStockAsync(); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); }
private void InitTradeClient() { TradeFacade.Clients().ForEach(BindTradeClient); }
private void On_Form_Close(object sender, FormClosingEventArgs e) { TradeFacade.Clients().ForEach(UnBindTradeClient); StockFacade.QuoteCache.OnCacheUpdated -= On_StockUpdate; }
private void comboAccountNo_TextChanged(object sender, EventArgs e) { ChangeCurrent(TradeFacade.GetClient(comboAccountNo.Text)); }