/Main/src/DynamicDataDisplay/Charts/DebugMenu.cs
C# | 61 lines | 47 code | 8 blank | 6 comment | 1 complexity | fd5d95831848288001a206f06c800ca8 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Controls;
- using System.Windows;
-
- namespace Microsoft.Research.DynamicDataDisplay.Charts
- {
- /// <summary>
- /// Represents a menu that appears in Debug version of DynamicDataDisplay.
- /// </summary>
- public class DebugMenu : IPlotterElement
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="DebugMenu"/> class.
- /// </summary>
- public DebugMenu()
- {
- Panel.SetZIndex(menu, 1);
- }
-
- private Plotter plotter;
- private readonly Menu menu = new Menu
- {
- HorizontalAlignment = HorizontalAlignment.Left,
- VerticalAlignment = VerticalAlignment.Top,
- Margin = new Thickness(3)
- };
- public Menu Menu
- {
- get { return menu; }
- }
-
- public MenuItem TryFindMenuItem(string itemName)
- {
- return menu.Items.OfType<MenuItem>().Where(item => (string)item.Header == itemName).FirstOrDefault();
- }
-
- #region IPlotterElement Members
-
- public void OnPlotterAttached(Plotter plotter)
- {
- this.plotter = plotter;
- plotter.CentralGrid.Children.Add(menu);
- }
-
- public void OnPlotterDetaching(Plotter plotter)
- {
- plotter.CentralGrid.Children.Remove(menu);
- this.plotter = null;
- }
-
- public Plotter Plotter
- {
- get { return plotter; }
- }
-
- #endregion
- }
- }