private void _addGraphLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AddGraphDlg dlg = new AddGraphDlg(); if (dlg.ShowDialog() == DialogResult.OK) { AddGraph(dlg.GraphName, dlg.Resolution * TimeSpan.TicksPerMillisecond, dlg.ShowTimeLabels); } }
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; } }