Exemplo n.º 1
0
            private void AddGraphControl(string text, GraphControlActions action)
            {
                LinkLabel label = CreateLinkLabel(text, Color.Black);

                label.Tag    = action;
                label.Click += new EventHandler(graphLabel_Click);

                _graphControlsPanel.Controls.Add(label);
            }
Exemplo n.º 2
0
            void graphLabel_Click(object sender, EventArgs e)
            {
                Control             c = (Control)sender;
                GraphControlActions a = (GraphControlActions)c.Tag;

                switch (a)
                {
                case GraphControlActions.ChangeName:
                    AddGraphDlg dlg = new AddGraphDlg();
                    dlg.Text           = "Change Graph Settings";
                    dlg.GraphName      = _graph.Name;
                    dlg.Resolution     = _graph.Resolution;
                    dlg.ShowTimeLabels = _graph.ShowTimeLabels;

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        _graph.Name           = dlg.GraphName;
                        _graph.Resolution     = dlg.Resolution * TimeSpan.TicksPerMillisecond;
                        _graph.ShowTimeLabels = dlg.ShowTimeLabels;

                        ((LinkLabel)c).Text = dlg.GraphName;
                    }

                    break;

                case GraphControlActions.AddView:
                    _control.RaiseOnAddView(_graph);
                    break;

                case GraphControlActions.ToggleTimeLabels:
                    _graph.ShowTimeLabels = !_graph.ShowTimeLabels;
                    break;

                case GraphControlActions.MoveUp:
                    _control.MoveGraphUp(_graph);
                    break;

                case GraphControlActions.MoveDown:
                    _control.MoveGraphDown(_graph);
                    break;

                case GraphControlActions.Remove:
                    if (MessageBox.Show(_control._seriesLabelsPanel.Parent, "Are you sure that you want to remove this graph?", "Remove Graph?",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        _control.RemoveGraph(_graph);
                    }
                    break;
                }
            }