private ContextMenuStrip Ecb_GetContextMenuRequest(ChannelEditor sender) { for (int i = 0; i < ChannelEditors.Length; i++) { if (ChannelEditors[i] == sender) { return(dsCollection.SeriesList[i].ContextMenuStrip); } } return(null); }
private bool Ecb_EnableChanged(ChannelEditor channelEditor, bool enable) { if (ChannelEditors.ToList().Count(ce => ce.Checked) == 0) { return(false); } channelEditor.TimeSeries.Enabled = enable; logControl.dsEnabledUpdated(ChannelEditors.ToList().IndexOf(channelEditor), enable); resetChannelEditorTops(); return(true); }
/// <summary> /// Initializes the control with a fixed number of maximum supported channels. /// The channels can later be disabled but NOT removed. /// </summary> public CompleteLogControl() { InitializeComponent(); HW = new LoggerHardware(); HW.OnSignatureUpdate += HW_OnSignatureUpdate; HW.OnDisconnectRequested += HW_OnDisconnectRequested; ChannelEditors = new ChannelEditor[NoS]; for (int i = 0; i < NoS; i++) { ChannelEditor ecb = new ChannelEditor(i); // Do one time setup ecb.Anchor = AnchorStyles.Right | AnchorStyles.Top; ecb.Width = Width - logControl.Width - 5; ecb.Height = 80; ecb.Left = Width - ecb.Width; ecb.Top = 5 + i * 100; ecb.TextUpdated += Ecb_TextUpdated; ecb.EnableChanged += Ecb_EnableChanged; ecb.GetContextMenuRequest += Ecb_GetContextMenuRequest; ecb.MouseEntered += Ecb_MouseEntered; ecb.MouseLeft += Ecb_MouseLeft; ChannelEditors[i] = ecb; this.Controls.Add(ecb); } dsCollection = new TimeSeriesCollection(NoS); // enable only the first two channels by default for (int i = 0; i < NoS; i++) { dsCollection[i].Enabled = i < 2; } ChannelOptions = new ChannelOptionsCollection[NoS]; for (int i = 0; i < NoS; i++) { ChannelOptions[i] = new ChannelOptionsCollection(i); } }