using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.Windows; namespace Microsoft.Research.DynamicDataDisplay.Charts { /// /// Represents a menu that appears in Debug version of DynamicDataDisplay. /// public class DebugMenu : IPlotterElement { /// /// Initializes a new instance of the class. /// 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().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 } }