AddMenuItem() public method

public AddMenuItem ( string header ) : System.Windows.Controls.MenuItem
header string
return System.Windows.Controls.MenuItem
Exemplo n.º 1
0
        private MenuPopupViewModel GetMenu(FrameworkElement fe)
        {
            var menu = new MenuPopupViewModel
            {
                RelativeElement   = fe,
                RelativePosition  = new Point(35, -5),
                TimeOut           = new TimeSpan(0, 0, 0, 15),
                VerticalAlignment = VerticalAlignment.Top,
                DisplayProperty   = string.Empty,
                AutoClose         = true
            };

            menu.AddMenuItem("<none>");
            foreach (var wtl in AppState.ViewDef.BaseLayerProviders)
            {
                menu.AddMenuItem(wtl.Title);
            }

            return menu;
        }
Exemplo n.º 2
0
        private void _partStream_Click(object sender, RoutedEventArgs e) {
            var menu = new MenuPopupViewModel {
                RelativeElement = _partStream,
                RelativePosition = new Point(0, 0),
                TimeOut = new TimeSpan(0, 0, 0, 5),
                VerticalAlignment = VerticalAlignment.Top,
                AutoClose = true
            };
            //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);
            //menu.DisplayProperty = "ServiceName";
            menu.Selected += MenuSelected;
            foreach (var ep in endPoints) {
                var mi = menu.AddMenuItem(ep.Title);
                mi.Tag = ep;
            }
            //foreach (ImbClientStatus a in AppStateSettings.Instance.Imb.Clients.Values.Where(k => k.Client))
            //{
            //  System.Windows.Controls.MenuItem mi = menu.AddMenuItem(a.Name);
            //  mi.Tag = a;
            //}
            //var config = menu.AddMenuItem("Configuration");

            AppStateSettings.Instance.Popups.Add(menu);
        }
Exemplo n.º 3
0
        public void OpenFunctionOperationMenu(DataSet ds, SurfaceButton b)
        {
            var menu = new MenuPopupViewModel();
            menu.RelativeElement = b;
            menu.RelativePosition = new Point(0, 0);
            menu.TimeOut = new TimeSpan(0, 0, 0, 5);
            //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);
            menu.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            //menu.DisplayProperty = "ServiceName";
            menu.AutoClose = true;

            foreach (var a in Enum.GetValues(typeof(FunctionOperations)))
            {
                var mi = menu.AddMenuItem(a.ToString());
                mi.Click += (e, s) =>
                {
                    SelectedDataSet.FunctionOperation = (FunctionOperations)a;
                    UpdateDataSet(SelectedDataSet);
                    menu.Close();
                };
            }
            AppState.Popups.Add(menu);
        }
Exemplo n.º 4
0
        public void OpenDataSetMenu(DataSet ds, SurfaceButton b)
        {
            var menu = new MenuPopupViewModel();
            menu.RelativeElement = b;
            menu.RelativePosition = new Point(0, 0);
            menu.TimeOut = new TimeSpan(0, 0, 0, 5);
            //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);
            menu.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            //menu.DisplayProperty = "ServiceName";
            menu.AutoClose = true;
            var miRemove = menu.AddMenuItem("Remove");
            miRemove.Click += (e, s) =>
                {
                    DataSets.Remove(ds);
                    menu.Close();
                };

            var miFit = menu.AddMenuItem("Fit");
            miFit.Click += (e, s) =>
            {
                FitDataSet(ds);
                menu.Close();
            };

            var miDuplicate = menu.AddMenuItem("Duplicate");
            miDuplicate.Click += (e, s) =>
                {
                    DataSet d = ds.Clone() as DataSet;
                    DataSets.Add(d);
                    menu.Close();
                };

            var miEdit = menu.AddMenuItem("Edit");
            miEdit.Click += (e, s) =>
                {
                    SelectedDataSet = ds;
                    menu.Close();
                    EditDataSet = true;
                };


            var miDraw = menu.AddMenuItem("Draw");
            miDraw.Click += (e, s) =>
            {
                SelectedDataSet = ds;
                menu.Close();
                if (DrawDataSet == false)
                {
                    DrawDataSet = true;
                    // Subscribe to the mouse down event on the line series
                    _view.PreviewMouseLeftButtonDown += _view_PreviewMouseLeftButtonDown;
                    _view.PreviewMouseMove += _view_PreviewMouseMove;
                    _view.PreviewMouseLeftButtonUp += _view_PreviewMouseLeftButtonUp;
                    

                }
                else
                {
                    DrawDataSet = false;
                }
            };
            AppState.Popups.Add(menu);
        }
Exemplo n.º 5
0
        private void BFocusTimeMouseUp(object sender, MouseButtonEventArgs e)
        {
            isMouseDownBm = false;
            isMouseDown = false;
            e.MouseDevice.Capture(null);
            e.Handled = true;

            if (bFocusMouseStart.AddMilliseconds(200) > AppState.TimelineManager.CurrentTime)
            {
                var menu = new MenuPopupViewModel
                {
                    RelativeElement = bFocusTime,
                    RelativePosition = new Point(-50, -15),
                    TimeOut = new TimeSpan(0, 0, 0, 5),
                    VerticalAlignment = VerticalAlignment.Bottom,
                };
                //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);

                menu.AddMenuItem("Go to now").Click += (s, es) =>
                {
                    Timeline.Start = AppState.TimelineManager.CurrentTime.AddDays(-1);
                    Timeline.End = AppState.TimelineManager.CurrentTime.AddDays(1);
                    Timeline.ForceTimeChanged();
                    Timeline.SetFocusTime(AppState.TimelineManager.CurrentTime);
                    Timeline.ForceTimeChanged();
                };

                AppState.Popups.Add(menu);
            }
        }
Exemplo n.º 6
0
        public void ChangeStringValue(FrameworkElement button)
        {
            var menu = new MenuPopupViewModel
            {
                RelativeElement = button,
                RelativePosition = new Point(35, -5),
                TimeOut = new TimeSpan(0, 0, 0, 5),
                VerticalAlignment = VerticalAlignment.Bottom,
                DisplayProperty = string.Empty,
                AutoClose = true
            };
            var options = new List<string>();
            foreach (var p in Service.PoIs.Where(k => ((PoI) k).PoiTypeId == Highlighter.PoiType))
            {
                if (p.Labels.ContainsKey(Highlighter.SelectionCriteria) &&
                    !options.Contains(p.Labels[Highlighter.SelectionCriteria]))
                {
                    options.Add(p.Labels[Highlighter.SelectionCriteria]);
                }
            }

            //var types = Enum.GetValues(typeof(VisualTypes));
            foreach (var t in options)
            {
                var mi = menu.AddMenuItem(t);
                var t1 = t;
                mi.Click += (o, e) =>
                {
                    Highlighter.StringValue = t1;
                    Refresh();
                };
            }

            AppStateSettings.Instance.Popups.Add(menu);
        }
Exemplo n.º 7
0
        public void ChangeVisualType(FrameworkElement button)
        {
            var menu = new MenuPopupViewModel
            {
                RelativeElement = button,
                RelativePosition = new Point(35, -5),
                TimeOut = new TimeSpan(0, 0, 0, 5),
                VerticalAlignment = VerticalAlignment.Bottom,
                DisplayProperty = string.Empty,
                AutoClose = true
            };
            var types = Enum.GetValues(typeof(VisualTypes));
            foreach (VisualTypes t in types)
            {
                var mi = menu.AddMenuItem(t.ToString());
                var t1 = t;
                mi.Click += (o, e) =>
                {
                    Highlighter.VisualType = t1;
                    Service.ResetFilters();
                };
            }

            AppStateSettings.Instance.Popups.Add(menu);
        }