Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows.Controls;
|
---|
| 6 | using System.Windows;
|
---|
| 7 |
|
---|
| 8 | namespace Microsoft.Research.DynamicDataDisplay.Charts
|
---|
| 9 | {
|
---|
| 10 | /// <summary>
|
---|
| 11 | /// Represents a menu that appears in Debug version of DynamicDataDisplay.
|
---|
| 12 | /// </summary>
|
---|
| 13 | public class DebugMenu : IPlotterElement
|
---|
| 14 | {
|
---|
| 15 | /// <summary>
|
---|
| 16 | /// Initializes a new instance of the <see cref="DebugMenu"/> class.
|
---|
| 17 | /// </summary>
|
---|
| 18 | public DebugMenu()
|
---|
| 19 | {
|
---|
| 20 | Panel.SetZIndex(menu, 1);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | private Plotter plotter;
|
---|
| 24 | private readonly Menu menu = new Menu
|
---|
| 25 | {
|
---|
| 26 | HorizontalAlignment = HorizontalAlignment.Left,
|
---|
| 27 | VerticalAlignment = VerticalAlignment.Top,
|
---|
| 28 | Margin = new Thickness(3)
|
---|
| 29 | };
|
---|
| 30 | public Menu Menu
|
---|
| 31 | {
|
---|
| 32 | get { return menu; }
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | public MenuItem TryFindMenuItem(string itemName)
|
---|
| 36 | {
|
---|
| 37 | return menu.Items.OfType<MenuItem>().Where(item => (string)item.Header == itemName).FirstOrDefault();
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | #region IPlotterElement Members
|
---|
| 41 |
|
---|
| 42 | public void OnPlotterAttached(Plotter plotter)
|
---|
| 43 | {
|
---|
| 44 | this.plotter = plotter;
|
---|
| 45 | plotter.CentralGrid.Children.Add(menu);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public void OnPlotterDetaching(Plotter plotter)
|
---|
| 49 | {
|
---|
| 50 | plotter.CentralGrid.Children.Remove(menu);
|
---|
| 51 | this.plotter = null;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public Plotter Plotter
|
---|
| 55 | {
|
---|
| 56 | get { return plotter; }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | #endregion
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.