Exemplo n.º 1
0
 /// <summary>Handle this window becoming active</summary>
 private void HandleActiveChanged(object sender, EventArgs e)
 {
     if (DockControl.IsActiveContent)
     {
         DockControl.TabColoursActive.Text = Color.Black;
         DockControl.InvalidateTab();
     }
 }
Exemplo n.º 2
0
        /// <summary>Handle the list of log entries changing</summary>
        private void HandleLogEntriesChanging(object sender, ListChgEventArgs <LogEntry> e)
        {
            if (!e.After || !e.IsDataChanged)
            {
                return;
            }

            // Auto tail
            var auto_tail = m_view.CurrentCell?.RowIndex == m_view.RowCount - 1 || m_view.RowCount == 0;

            // Update the row count to the number of log entries
            m_view.RowCount = Math.Min(MaxLines, LogEntries.Count);

            // Auto scroll to the last row
            if (auto_tail)
            {
                TailScroll();
            }

            // If a log entry was added, pop-out.
            if (e.ChangeType == ListChg.ItemAdded && DockControl?.DockContainer != null)
            {
                if (PopOutOnNewMessages)
                {
                    DockControl.DockContainer.FindAndShow(this);
                }
                else
                {
                    DockControl.TabColoursActive.Text = Color.Red;
                    DockControl.InvalidateTab();
                }
            }

            // Prevent the LogEntries collection getting too big
            if (e.ChangeType == ListChg.ItemAdded && LogEntries.Count > 2 * MaxLines)
            {
                LogEntries.RemoveRange(0, LogEntries.Count - MaxLines);
            }
        }