Trace() public static méthode

Outputs debug trace message
public static Trace ( this sender, object msgObject = null, bool condition = true ) : void
sender this
msgObject object
condition bool
Résultat void
        ///
        /// <summary>
        /// This calculates row for each of event (makes sense only for main band).
        /// We try to place evens so that the do not overlap on the screen.</summary>
        ///
        public void CalculateEventRows(
            )
        {
            int count;
            int rowCount;
            int minIndex;

            DateTime[]    dates;
            DateTime      minDate;
            TimelineEvent e;
            int           overrideRowCount;

            Debug.Assert(m_assignRows);
            Debug.Assert(AllEvents != null);

            Utilities.Trace(this);

            rowCount = (int)((PixelHeight - TOP_MARGIN - BOTTOM_MARGIN) / m_maxEventHeight);

            if (AllEvents.Count > 0)
            {
                overrideRowCount = AllEvents.Max((s) => { return(s.RowOverride); }) + 1;
                rowCount         = Math.Max(rowCount, overrideRowCount);
            }

            if (rowCount == 0)
            {
                for (int i = 0; i < AllEvents.Count; ++i)
                {
                    e     = AllEvents[i];
                    e.Row = 0;
                }
            }
            else
            {
                dates = new DateTime[rowCount];

                for (int i = 0; i < rowCount; ++i)
                {
                    dates[i] = new DateTime();
                }

                count = AllEvents.Count;

                for (int i = 0; i < count; ++i)
                {
                    minDate  = dates[0];
                    minIndex = 0;
                    e        = AllEvents[i];

                    if (e.RowOverride == -1)
                    {
                        for (int k = 0; k < rowCount; ++k)
                        {
                            if (minDate > dates[k])
                            {
                                minIndex = k;
                                minDate  = dates[k];
                            }
                        }

                        dates[minIndex] = e.EndDate;
                        e.Row           = minIndex;
                    }
                    else
                    {
                        e.Row        = e.RowOverride;
                        dates[e.Row] = e.EndDate;
                    }
                }
            }
        }
        ///
        /// <summary>
        /// Build columns (one for each years, dates, etc.)</summary>
        ///
        public void BuildColumns(
            bool animate       = false,
            bool displayEvents = false,
            Size?newSize       = null
            )
        {
            double step;
            double width;
            double height;
            double left;

            FrameworkElement[] columns;
            FrameworkElement[] markers;
            int i;

            Utilities.Trace(this);

            if (newSize == null)
            {
                width  = PixelWidth;
                height = PixelHeight;
            }
            else
            {
                width  = newSize.Value.Width;
                height = newSize.Value.Height;
            }

            step = ColumnPixelWidth;

            if (m_columns == null || m_columns.Length != m_columnCount + EXTRA_COLUMNS)
            {
                columns = new FrameworkElement[m_columnCount + EXTRA_COLUMNS];
                markers = new FrameworkElement[m_columnCount + EXTRA_COLUMNS];

                if (m_columns != null)
                {
                    Array.Copy(m_columns, columns, Math.Min(columns.Length, m_columns.Length));

                    for (i = columns.Length; i < m_columns.Length; ++i)
                    {
                        m_canvas.Children.Remove(m_columns[i]);
                    }
                }

                if (m_columnMarkers != null)
                {
                    Array.Copy(m_columnMarkers, markers, Math.Min(markers.Length, m_columnMarkers.Length));

                    for (i = markers.Length; i < m_columnMarkers.Length; ++i)
                    {
                        m_canvas.Children.Remove(m_columnMarkers[i]);
                    }
                }
                m_columns       = columns;
                m_columnMarkers = markers;
            }

            for (i = 0; i < m_columnCount + EXTRA_COLUMNS; ++i)
            {
                left = ColumnPixelWidth * (i - 1);

                if (m_columns[i] == null)
                {
                    m_columns[i]             = m_template.LoadContent() as FrameworkElement;
                    m_columns[i].DataContext = null;
                    m_canvas.Children.Add(m_columns[i]);
                }

                if (m_markerTemplate != null && m_columnMarkers[i] == null)
                {
                    m_columnMarkers[i]             = m_markerTemplate.LoadContent() as FrameworkElement;
                    m_columnMarkers[i].DataContext = null;
                    m_canvas.Children.Add(m_columnMarkers[i]);
                }
            }

            FixPositions(displayEvents, animate, true);
        }