public ParserPanel() { InitializeComponent(); _messageTable = new ParserMessageDataTable("Messages"); _messageView = new DataView(_messageTable); _fieldTable = new FieldDataTable("Fields"); _fieldView = new DataView(_fieldTable); _messageSearchTextBox = new SearchTextBox { Dock = DockStyle.Top }; _messageSearchTextBox.TextChanged += MessageSearchTextBoxTextChanged; _fieldSearchTextBox = new SearchTextBox { Dock = DockStyle.Top }; _fieldSearchTextBox.TextChanged += FieldSearchTextBoxTextChanged; _statusMessage = new TextBox { Dock = DockStyle.Bottom, ReadOnly = true }; messageStatusErrorImage = Properties.Resources.MessageStatusError; messageStatusInfoImage = Properties.Resources.MessageStatusInfo; messageStatusWarnImage = Properties.Resources.MessageStatusWarn; messageStatusNoneImage = Properties.Resources.MessageStatusNone; #region ToolStrip var loadButton = new ToolStripButton(Properties.Resources.Open) { ImageTransparentColor = Color.Magenta, ToolTipText = "Load a Glue/Gate/FIX Router/Desk Server log file" }; loadButton.Click += LoadClientMessagesButtonClick; _showAdminMessageCheckBox = new ToolStripCheckBox(); _showAdminMessageCheckBox.CheckChanged += ShowAdminMessageCheckBoxCheckChanged; _statusNoneMenuItem = new ToolStripMenuItem { Text = "None", Checked = true, CheckOnClick = true }; _statusNoneMenuItem.Click += StatusMenuItemClick; _statusInfoMenuItem = new ToolStripMenuItem { Text = "Info", Checked = true, CheckOnClick = true }; _statusInfoMenuItem.Click += StatusMenuItemClick; _statusWarnMenuItem = new ToolStripMenuItem { Text = "Warn", Checked = true, CheckOnClick = true }; _statusWarnMenuItem.Click += StatusMenuItemClick; _statusErrorMenuItem = new ToolStripMenuItem { Text = "Error", Checked = true, CheckOnClick = true }; _statusErrorMenuItem.Click += StatusMenuItemClick; _statusButton = new ToolStripDropDownButton("Message Status"); _statusButton.DropDownItems.Add(_statusNoneMenuItem); _statusButton.DropDownItems.Add(_statusInfoMenuItem); _statusButton.DropDownItems.Add(_statusWarnMenuItem); _statusButton.DropDownItems.Add(_statusErrorMenuItem); var toolStrip = new ToolStrip(new ToolStripItem[] { loadButton, new ToolStripLabel("Show Administrative Messages"), _showAdminMessageCheckBox, _statusButton }) { GripStyle = ToolStripGripStyle.Hidden, BackColor = LookAndFeel.Color.ToolStrip, Renderer = new ToolStripRenderer() }; #endregion var splitter = new SplitContainer { Orientation = Orientation.Horizontal, Dock = DockStyle.Fill, SplitterDistance = 200 }; var messageSplitter = new SplitContainer { Orientation = Orientation.Vertical, Dock = DockStyle.Fill }; var container = new ToolStripContainer { Dock = DockStyle.Fill }; container.ContentPanel.Controls.Add(messageSplitter); container.TopToolStripPanel.Join(toolStrip); container.TopToolStripPanel.BackColor = LookAndFeel.Color.ToolStrip; _messageGridView = new ParserMessageDataGridView { Dock = DockStyle.Fill, VirtualMode = true }; _messageGridView.SelectionChanged += ClientMessageGridGridSelectionChanged; _messageGridView.CellValueNeeded += MessageGridViewCellValueNeeded; _messageGridView.CellFormatting += MessageGridViewCellFormatting; foreach (DataColumn source in _messageTable.Columns) { if (source.ColumnMapping == MappingType.Hidden) { continue; } DataGridViewColumn column; if (source.DataType == typeof(Image)) { column = new DataGridViewImageColumn { Name = source.ColumnName, ValueType = source.DataType }; } else { column = new DataGridViewTextBoxColumn { Name = source.ColumnName, ValueType = source.DataType }; } _messageGridView.Columns.Add(column); } var fieldGridView = new FieldDataGridView { Dock = DockStyle.Fill, DataSource = _fieldView }; messageSplitter.Panel1.Controls.Add(_messageGridView); messageSplitter.Panel1.Controls.Add(_messageSearchTextBox); messageSplitter.Panel2.Controls.Add(fieldGridView); messageSplitter.Panel2.Controls.Add(_fieldSearchTextBox); messageSplitter.Panel2.Controls.Add(_statusMessage); _orderBook = new Fix.OrderBook(); _orderBook.Messages.MessageAdded += MessagesMessageAdded; _orderBook.OrderInserted += OrderBookOrderInserted; _orderBook.OrderUpdated += OrderBookOrderUpdated; _orderTable = new OrderDataTable("Orders"); _orderView = new DataView(_orderTable); orderGrid = new OrderDataGridView { DataSource = _orderView, Dock = DockStyle.Fill, DisplayExDestination = true }; _orderSearchTextBox = new SearchTextBox { Dock = DockStyle.Top }; _orderSearchTextBox.TextChanged += OrderSearchTextBoxTextChanged; splitter.Panel1.Controls.Add(container); splitter.Panel2.Controls.Add(orderGrid); splitter.Panel2.Controls.Add(_orderSearchTextBox); ContentPanel.Controls.Add(splitter); ShowAdminMessageCheckBoxCheckChanged(this, null); }
public OrdersPanel(MessagesPanel messageDefaults, ToolStripButton defaultsButton) { _messageDefaults = messageDefaults; _defaultsButton = defaultsButton; #region ToolStrip _clientToolStrip = new ToolStrip { GripStyle = ToolStripGripStyle.Hidden, BackColor = LookAndFeel.Color.ToolStrip, Renderer = new ToolStripRenderer() }; _cancelButton = new ToolStripSplitButton { Text = "Cancel", ToolTipText = "Cancel the selected order" }; _cancelButton.Click += CancelButtonClick; _cancelAllButton = new ToolStripMenuItem { Text = "Cancel All", ToolTipText = "Cancel all open orders immediately" }; _cancelAllButton.Click += CancelAllButtonClick; _cancelButton.DropDownItems.Add(_cancelAllButton); _amendButton = new ToolStripButton { Text = "Amend", ToolTipText = "Amend the selected order" }; _amendButton.Click += AmendButtonClick; _statusButton = new ToolStripButton { Text = "Status", ToolTipText = "Request a status update for the selected order" }; _statusButton.Click += StatusButtonClick; _listExecuteButton = new ToolStripButton { Text = "ListExecute", ToolTipText = "Execute the Order List associated with the selected order" }; _listExecuteButton.Click += ListExecuteButtonClick; _listStatusButton = new ToolStripButton { Text = "ListStatus", ToolTipText = "Request the status of the Order List associated with the selected order" }; _listStatusButton.Click += ListStatusButtonClick; _listCancelButton = new ToolStripButton { Text = "ListCancel", ToolTipText = "Cancel the Order List associated with the selected order" }; _listCancelButton.Click += ListCancelButtonClick; _clientToolStrip.Items.AddRange(new ToolStripItem[] { _cancelButton, _amendButton, _statusButton, new ToolStripSeparator(), _listExecuteButton, _listStatusButton, _listCancelButton }); _serverToolStrip = new ToolStrip { GripStyle = ToolStripGripStyle.Hidden, BackColor = LookAndFeel.Color.ToolStrip, Renderer = new ToolStripRenderer() }; _ackButton = new ToolStripDropDownButton { Text = "Ack", ToolTipText = "Acknowledge the selected order" }; _ackButton.Click += AckButtonClick; _ackAllButton = new ToolStripMenuItem { Text = "Acknowledge All", ToolTipText = "Acknowledge all pending orders immediately" }; _ackAllButton.Click += AcknowledgeAllButtonClick; _ackButton.DropDownItems.Add(_ackAllButton); _rejectButton = new ToolStripDropDownButton { Text = "Reject", ToolTipText = "Reject the selected order" }; _rejectButton.Click += RejectButtonClick; _rejectAllButton = new ToolStripMenuItem { Text = "Reject All", ToolTipText = "Reject all pending orders immediately" }; _rejectAllButton.Click += RejectAllButtonClick; _rejectButton.DropDownItems.Add(_rejectAllButton); _acceptorCancelButton = new ToolStripSplitButton { Text = "Cancel", ToolTipText = "Cancel the selected order" }; _acceptorCancelButton.Click += CancelButtonClick; _acceptorCancelAllButton = new ToolStripMenuItem { Text = "Cancel All", ToolTipText = "Cancel all open orders immediately" }; _acceptorCancelAllButton.Click += CancelAllButtonClick; _acceptorCancelButton.DropDownItems.Add(_acceptorCancelAllButton); _reportButton = new ToolStripButton { Text = "Report", ToolTipText = "Send an execution teport for the selected order" }; _reportButton.Click += ReportButtonClick; _serverToolStrip.Items.AddRange(new ToolStripItem[] { _ackButton, _rejectButton, _acceptorCancelButton, _reportButton }); #endregion #region MenuStrip _clientMenuStrip = new ToolStripMenuItem("Action"); _cancelMenuItem = new ToolStripMenuItem("Cancel", _cancelButton.Image); _cancelMenuItem.Click += CancelButtonClick; _clientMenuStrip.DropDownItems.Add(_cancelMenuItem); _amendMenuItem = new ToolStripMenuItem("Amend", _amendButton.Image); _amendMenuItem.Click += AmendButtonClick; _clientMenuStrip.DropDownItems.Add(_amendMenuItem); _statusMenuItem = new ToolStripMenuItem("Status", _statusButton.Image); _statusMenuItem.Click += StatusButtonClick; _clientMenuStrip.DropDownItems.Add(_statusMenuItem); _clientMenuStrip.DropDownItems.Add(new ToolStripSeparator()); _listExecuteMenuItem = new ToolStripMenuItem("ListExecute", _listExecuteButton.Image); _listExecuteMenuItem.Click += ListExecuteButtonClick; _clientMenuStrip.DropDownItems.Add(_listExecuteMenuItem); _listStatusMenuItem = new ToolStripMenuItem("ListStatus", _listStatusButton.Image); _listStatusMenuItem.Click += ListStatusButtonClick; _clientMenuStrip.DropDownItems.Add(_listStatusMenuItem); _listCancelMenuItem = new ToolStripMenuItem("ListCancel", _listCancelButton.Image); _listCancelMenuItem.Click += ListCancelButtonClick; _clientMenuStrip.DropDownItems.Add(_listCancelMenuItem); _serverMenuStrip = new ToolStripMenuItem("Action"); _ackMenuItem = new ToolStripMenuItem("Acknowledge", _ackButton.Image); _ackMenuItem.Click += AckButtonClick; _serverMenuStrip.DropDownItems.Add(_ackMenuItem); _rejectMenuItem = new ToolStripMenuItem("Reject", _rejectButton.Image); _rejectMenuItem.Click += RejectButtonClick; _serverMenuStrip.DropDownItems.Add(_rejectMenuItem); _reportMenuItem = new ToolStripMenuItem("Report", _reportButton.Image); _reportMenuItem.Click += ReportButtonClick; _serverMenuStrip.DropDownItems.Add(_reportMenuItem); #endregion _orderTable = new OrderDataTable("Orders"); _orderView = new DataView(_orderTable); _orderGrid = new OrderDataGridView { Dock = DockStyle.Fill, DataSource = _orderView }; _orderGrid.SelectionChanged += (sender, ev) => UpdateUiState(); _orderSearchTextBox = new SearchTextBox { Dock = DockStyle.Top }; _orderSearchTextBox.TextChanged += (sender, ev) => ApplyFilters(); ContentPanel.Controls.Add(_orderGrid); ContentPanel.Controls.Add(_orderSearchTextBox); UpdateUiState(); ApplyFilters(); IntPtr h = Handle; }