private void priceListView_DoubleClick(object sender, EventArgs e) { AnalyzerSession session = null; SessionInfo seletedSession = SelectedSession.Value; bool existed = false; foreach (ToolStripButton button in GetSessionsButtons()) { if (((AnalyzerSessionControl)(button.Tag)).AnalyzerSession.SessionInfo.Symbol == seletedSession.Symbol) { button.Checked = true; existed = true; ((AnalyzerSessionControl)(button.Tag)).Visible = true; session = ((AnalyzerSessionControl)(button.Tag)).AnalyzerSession; } else { ((AnalyzerSessionControl)(button.Tag)).Visible = false; } } if (!existed) { foreach (SessionInfo sin in FxpaSource.AvailableSessionList) { if (sin.Symbol == seletedSession.Symbol) { session = _host.CreateSimulationSession(seletedSession); break; } } } if (session == null) { MessageBox.Show("该商品没有被订阅。", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error); foreach (ToolStripButton button in GetSessionsButtons()) { button.Checked = true; ((AnalyzerSessionControl)(button.Tag)).Visible = true; } } else { closeToolStripButton.Enabled = true; if (!aliveSessions.Contains(session.Symbol.ToString())) { aliveSessions.Add(session.Symbol.ToString()); } UpdateUI(); //GeneralHelper.SafeEventRaise(_host.SessionsUpdateEvent, _host); //SessionCreatedEvent(); } }
/// <summary> /// /// </summary> public FxAnalyzerControl(ProfessionalAnalyzer expert) { InitializeComponent(); tradeAnalyzer = expert; tradeAnalyzer.SessionManager.SessionsUpdateEvent += new GeneralHelper.GenericDelegate<IAnalyzerSessionManager>(SessionManager_SessionUpdateEvent); //Adjust Listview column width priceListView_ColumnWidthChanged(); DataService.priceList = priceListView; DataService.ImageList = imageList1; //��������Դ _host = tradeAnalyzer.SessionManager; _sessions = null; _sessions = FxpaSource.SessionList.ToArray(); int i; for (i = 0; i < _sessions.Length; i++) { string symbol = AppUtil.GetSymbolChinese(_sessions[i].Symbol); if (symbol != "") { ListViewItem p = new ListViewItem(new string[] { AppUtil.GetSymbolChinese(_sessions[i].Symbol), "", "", "" }); priceListView.Items.Add(p); } } //priceListView.Items.AddRange(p); // Comment by Harry //���������Զ�Adjust ��ͷ��С //AutoResizeColumnWidth(priceListView); // DateTime now = DateTime.Now; //this.titleStrip1.HeaderText.Text = " " + now.ToString("MM dd, yyyy " + AppConst.Days[Convert.ToInt16(now.DayOfWeek)]); //this.titleStrip1.HeaderText.Font = new Font(this.titleStrip1.HeaderText.Font, FontStyle.Bold); //this.titleStrip1.HeaderText.Margin = new Padding(10, 0, 0, 0); //this.titleStrip1.HeaderText.ForeColor = Color.FromArgb(91, 89, 91); timeLabel.Text =now.ToString("MM'��'dd' day ' " + AppConst.Days[Convert.ToInt16(now.DayOfWeek)]); //this.label1.Margin = new Padding(10, 0, 0, 0); //this.label1.ForeColor = Color.FromArgb(91, 89, 91); timeLabel.Refresh(); AnalyzerSession session; foreach (SessionInfo sin in FxpaSource.AvailableSessionList) { aliveSessions.Add(sin.Symbol); session = _host.CreateSimulationSession(sin); break; } //AppContext.SignalHandler.PriceListView = priceListView; //AppContext.SignalHandler.AnalyzerControl = this; //AppContext.SignalListHandler.PriceListView = priceListView; // AppContext.TimeCheckHandler.PriceListView = priceListView; AppContext.PriceListView = priceListView; AppContext.TradeAnalyzerControl = this; }
/// <summary> /// /// </summary> public FxAnalyzerControl(ProfessionalAnalyzer expert) { InitializeComponent(); tradeAnalyzer = expert; tradeAnalyzer.SessionManager.SessionsUpdateEvent += new GeneralHelper.GenericDelegate <IAnalyzerSessionManager>(SessionManager_SessionUpdateEvent); //Adjust Listview column width priceListView_ColumnWidthChanged(); DataService.priceList = priceListView; DataService.ImageList = imageList1; //设置数据源 _host = tradeAnalyzer.SessionManager; _sessions = null; _sessions = FxpaSource.SessionList.ToArray(); int i; for (i = 0; i < _sessions.Length; i++) { string symbol = AppUtil.GetSymbolChinese(_sessions[i].Symbol); if (symbol != "") { ListViewItem p = new ListViewItem(new string[] { AppUtil.GetSymbolChinese(_sessions[i].Symbol), "", "", "" }); priceListView.Items.Add(p); } } //priceListView.Items.AddRange(p); // Comment by Harry //根据内容自动Adjust 列头大小 //AutoResizeColumnWidth(priceListView); // DateTime now = DateTime.Now; //this.titleStrip1.HeaderText.Text = " " + now.ToString("MM dd, yyyy " + AppConst.Days[Convert.ToInt16(now.DayOfWeek)]); //this.titleStrip1.HeaderText.Font = new Font(this.titleStrip1.HeaderText.Font, FontStyle.Bold); //this.titleStrip1.HeaderText.Margin = new Padding(10, 0, 0, 0); //this.titleStrip1.HeaderText.ForeColor = Color.FromArgb(91, 89, 91); timeLabel.Text = now.ToString("MM'月'dd' day ' " + AppConst.Days[Convert.ToInt16(now.DayOfWeek)]); //this.label1.Margin = new Padding(10, 0, 0, 0); //this.label1.ForeColor = Color.FromArgb(91, 89, 91); timeLabel.Refresh(); AnalyzerSession session; foreach (SessionInfo sin in FxpaSource.AvailableSessionList) { aliveSessions.Add(sin.Symbol); session = _host.CreateSimulationSession(sin); break; } //AppContext.SignalHandler.PriceListView = priceListView; //AppContext.SignalHandler.AnalyzerControl = this; //AppContext.SignalListHandler.PriceListView = priceListView; // AppContext.TimeCheckHandler.PriceListView = priceListView; AppContext.PriceListView = priceListView; AppContext.TradeAnalyzerControl = this; }