コード例 #1
0
        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);
        }
コード例 #2
0
        public HistoryPanel()
        {
            InitializeComponent();

            #region ToolStrip
            var toolStrip = new ToolStrip
            {
                GripStyle = ToolStripGripStyle.Hidden,
                BackColor = LookAndFeel.Color.ToolStrip,
                Renderer  = new ToolStripRenderer()
            };


            _clearButton = new ToolStripButton
            {
                Image = Properties.Resources.Clear,
                ImageTransparentColor = Color.Magenta,
                ToolTipText           = "Clear all session messages"
            };
            _clearButton.Click += ClearButtonClick;

            _resendButton = new ToolStripButton
            {
                Image = Properties.Resources.Send,
                ImageTransparentColor = Color.White,
                ToolTipText           = "Resend the selected message"
            };
            _resendButton.Click += ResendButtonClick;

            _exportButton = new ToolStripButton
            {
                Image = Properties.Resources.Export,
                ImageTransparentColor = Color.Magenta,
                ToolTipText           = "Export the message history to a text file"
            };
            _exportButton.Click += ExportButtonClick;

            _tailMessagesCheckBox = new ToolStripCheckBox();
            _tailMessagesCheckBox.CheckChanged += TailMessagesCheckBoxCheckChanged;

            toolStrip.Items.AddRange(new ToolStripItem[]
            {
                _clearButton,
                _resendButton,
                _exportButton,
                new ToolStripLabel("Tail Messages"),
                _tailMessagesCheckBox
            });

            TopToolStripPanel.Join(toolStrip);

            #endregion

            #region MenuStrip
            var menu = new ToolStripMenuItem("Action");
            SetMenuStrip(menu);

            _clearMenuItem        = new ToolStripMenuItem("Clear", _clearButton.Image);
            _clearMenuItem.Click += ClearButtonClick;
            menu.DropDownItems.Add(_clearMenuItem);

            _resendMenuItem        = new ToolStripMenuItem("Resend", _resendButton.Image);
            _resendMenuItem.Click += ResendButtonClick;
            menu.DropDownItems.Add(_resendMenuItem);

            _exportMenuItem        = new ToolStripMenuItem("Export", _exportButton.Image);
            _exportMenuItem.Click += ExportButtonClick;
            menu.DropDownItems.Add(_exportMenuItem);
            #endregion

            _messageSearchTextBox = new SearchTextBox
            {
                Dock = DockStyle.Top,
            };
            _messageSearchTextBox.TextChanged += MessageSearchTextBoxTextChanged;
            _fieldSearchTextBox = new SearchTextBox
            {
                Dock = DockStyle.Top,
            };
            _fieldSearchTextBox.TextChanged += FieldSearchTextBoxTextChanged;

            var container = new SplitContainer
            {
                Dock        = DockStyle.Fill,
                Orientation = Orientation.Vertical
            };

            _messageGrid = new HistoryMessageDataGridView
            {
                Dock        = DockStyle.Fill,
                VirtualMode = true
            };
            _messageGrid.SelectionChanged += MessageGridSelectionChanged;
            _messageGrid.CellValueNeeded  += MessageGridCellValueNeeded;
            _messageGrid.CellFormatting   += MessageGridCellFormatting;

            _messageTable             = new MessageDataTable("Messages");
            _messageView              = new DataView(_messageTable);
            _messageView.ListChanged += ViewListChanged;

            _fieldTable = new FieldDataTable("Fields");
            _fieldView  = new DataView(_fieldTable);

            _fieldGrid = new FieldDataGridView
            {
                Dock       = DockStyle.Fill,
                DataSource = _fieldView
            };

            var rightSplitter = new SplitContainer
            {
                Dock             = DockStyle.Fill,
                Orientation      = Orientation.Horizontal,
                SplitterDistance = ClientRectangle.Height
            };

            _rawMessage = new TextBox
            {
                Dock        = DockStyle.Fill,
                Multiline   = true,
                ReadOnly    = true,
                Font        = new Font("Consolas", 10),
                BackColor   = LookAndFeel.Color.GridCellBackground,
                ForeColor   = LookAndFeel.Color.GridCellForeground,
                BorderStyle = BorderStyle.None
            };

            _statusMessage = new TextBox
            {
                Dock     = DockStyle.Bottom,
                ReadOnly = true
            };

            rightSplitter.Panel1.Controls.Add(_fieldGrid);
            rightSplitter.Panel1.Controls.Add(_fieldSearchTextBox);
            rightSplitter.Panel2.Controls.Add(_rawMessage);
            rightSplitter.Panel2.Controls.Add(_statusMessage);

            container.Panel1.Controls.Add(_messageGrid);
            container.Panel1.Controls.Add(_messageSearchTextBox);
            container.Panel2.Controls.Add(rightSplitter);

            ContentPanel.Controls.Add(container);

            IntPtr h = Handle;

            UpdateUiState();
        }