Example #1
0
 /// <summary>
 ///     Place an <see cref="SigmaPanel" /> onto the grid. For granular control use
 ///     <see cref="AddElement" />.
 /// </summary>
 /// <param name="panel">The <see cref="SigmaPanel" /> that will be added.</param>
 /// <param name="row">The row in which the <see cref="SigmaPanel" /> should be added.</param>
 /// <param name="column">The column in which the <see cref="SigmaPanel" /> should be added.</param>
 /// <param name="rowSpan">How many rows the <see cref="SigmaPanel" /> uses.</param>
 /// <param name="columnSpan">How many columns the <see cref="SigmaPanel" /> uses.</param>
 /// <param name="legend">Mark a panel to a special colour / legend. </param>
 /// <exception cref="ArgumentOutOfRangeException">
 ///     If rowSpan is smaller or equal to zero or if columnSpan
 ///     is smaller or equal to zero.
 /// </exception>
 /// <exception cref="IndexOutOfRangeException">If there is no space for the new <see cref="SigmaPanel" />. </exception>
 public void AddPanel(SigmaPanel panel, int row, int column, int rowSpan = 1, int columnSpan = 1,
                      StatusBarLegendInfo legend = null)
 {
     panel.Monitor = Monitor;
     AddElement(panel, row, column, rowSpan, columnSpan);
     ApplyLegend(panel, legend);
     panel.Initialise(Monitor.Window);
 }
Example #2
0
        /// <summary>
        ///     Apply the legend colour-coding to a passed panel.
        /// </summary>
        /// <param name="panel">The given panel. </param>
        /// <param name="legend">The given panel. </param>
        protected virtual void ApplyLegend(SigmaPanel panel, StatusBarLegendInfo legend)
        {
            if (legend != null)
            {
                panel.Header.Background = new SolidColorBrush(legend.LegendColor);

                if (legend.ForegroundColor.HasValue)
                {
                    SolidColorBrush brush = new SolidColorBrush(legend.ForegroundColor.Value);

                    foreach (object headerChild in panel.Header.Children)
                    {
                        Control control = headerChild as Control;
                        if (control != null)
                        {
                            control.Foreground = brush;
                        }
                    }
                }
            }
        }