public void AppendMsg(object obj) { PublishInfo info = (PublishInfo)obj; StringBuilder sb = new StringBuilder(); string msg = info.Content; sb.Append(info.DateTime.ToShortDateString()); sb.Append(SPACE); sb.Append(info.DateTime.ToLongTimeString()); sb.Append(SPACE); sb.Append(info.Type); sb.Append(Environment.NewLine); sb.Append(AppUtil.GetSymbolChinese(info.Symbol.ToString())); sb.Append(SPACE); sb.Append(msg); if (!msg.EndsWith(EN_DOT) && !msg.EndsWith(CN_DOT)) { sb.Append(CN_DOT); } sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); Font fBold = new Font("Arial", 10, FontStyle.Regular); lock (richTextBoxInfo) { if (richTextBoxInfo.Lines.Length > MAX) { richTextBoxInfo.Text = richTextBoxInfo.Text.Substring(richTextBoxInfo.Text.IndexOf(richTextBoxInfo.Lines[OFFSET])); lastColor = Color.DarkBlue; } richTextBoxInfo.Enabled = false; richTextBoxInfo.SelectionStart = richTextBoxInfo.Text.Length; richTextBoxInfo.SelectionFont = fBold; if (lastColor == Color.Red) { richTextBoxInfo.SelectionColor = Color.DarkBlue; lastColor = Color.DarkBlue; } else { richTextBoxInfo.SelectionColor = Color.Red; lastColor = Color.Red; } richTextBoxInfo.SelectedText = sb.ToString(); richTextBoxInfo.Enabled = true; } Opacity = 100; Visible = true; Show(); }
/// <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; }