Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/DebugMenu.cs @ 12503

Last change on this file since 12503 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Controls;
6using System.Windows;
7
8namespace 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.