Пример #1
0
 private void ReleaseSubscribe()
 {
     TradeFacade.Clients().ForEach((client) => {
         client.PlaceReportReceived  -= On_PlaceReportReceived;
         client.FillReportReceived   -= On_FillReportReceived;
         client.CancelReportReceived -= On_CancelReportReceived;
     });
 }
Пример #2
0
 private void InitSubscirbe()
 {
     TradeFacade.Clients().ForEach((client) => {
         client.PlaceReportReceived  += On_PlaceReportReceived;
         client.FillReportReceived   += On_FillReportReceived;
         client.CancelReportReceived += On_CancelReportReceived;
     });
 }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
 private void InitTradeClient()
 {
     TradeFacade.Clients().ForEach(BindTradeClient);
 }
Пример #6
0
 private void On_Form_Close(object sender, FormClosingEventArgs e)
 {
     TradeFacade.Clients().ForEach(UnBindTradeClient);
     StockFacade.QuoteCache.OnCacheUpdated -= On_StockUpdate;
 }
Пример #7
0
 private void comboAccountNo_TextChanged(object sender, EventArgs e)
 {
     ChangeCurrent(TradeFacade.GetClient(comboAccountNo.Text));
 }