void SetDsCollection(TimeSeriesCollection value, bool force) { if (dsCol != null && !force) { return; } dsCol = value; dsCol.GetBackColorRequest += DsCol_GetBackColorRequest; dsCol.InvalidateRequest += DsCol_InvalidateRequest; for (int i = 0; i < value.Count; i++) { ChannelEditors[i].Adapt(value[i]); // these two events are called by the context menu strip, whether on the plot or the channel editor. value[i].OnVisualsChanged += CompleteLogControl_OnVisualsChanged; } // this will automatically look for disabled series and hide the respective panels. resetChannelEditorTops(); if (dsCollection.TimeStamps.Count > 0) { dsCol.TimeStampsMax(value.TimeStamps.Max()); OnSessionLifeUpdated?.Invoke(value.TimeStampsMax()); } else { value.TimeStampsMax(0); OnSessionLifeUpdated?.Invoke(0); } logControl.dsCollectionUpdated(dsCol); logControl.Invalidate(); }
public void OnLoaded(object sender, EventArgs args) { Application.Idle -= new EventHandler(OnLoaded); // rest of your code // we need to work with resetting D3D FrameBuffer size, which couldn't be found in SlimDX. // Once this issue is resolved, we can use D3D. //completeLogControl.AttemptToAttachD3D(); string f = "LastSession.plprj"; if (!System.IO.File.Exists(f)) { f = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "LastSession.plprj"); } if (System.IO.File.Exists(f)) { var data = System.IO.File.ReadAllLines(f); TimeSeriesCollection ts = null; try { ts = TimeSeriesCollection.Deserialize(data); completeLogControl.UpdateChannelVisuals(TimeSeriesCollection.Deserialize(data)); } catch (Exception ex) { MessageBox.Show("PhysLogger has met an unexpected error and must be restarted. \r\n\r\nAdditional Information: " + ex.ToString()); System.IO.File.Delete(f); Close(); } } completeLogControl.DontScrollPlotOnReSize = true; //completeLogControl.HW.AttachVirtualLogger1(); }
public static TimeSeriesCollection Deserialize(string[] str) { TimeSeriesCollection ts = new TimeSeriesCollection(); int offset = 0; ts.UniqueXAxisStamps = Convert.ToBoolean(str[offset]); offset++; var tsCount = Convert.ToInt32(str[offset]); offset++; ts.TimeStamps = new List <float>(); for (int i = 0; i < tsCount; i++) { ts.TimeStamps.Add(Convert.ToSingle(str[offset])); offset++; } var seriesCount = Convert.ToInt32(str[offset]); offset++; ts.seriesList = new List <TimeSeries>(); for (int i = 0; i < seriesCount; i++) { var s = TimeSeries.Deserialize(str, ref offset, ts.seriesList.Count); s.GetTimeStampsRequest += ts.Ds_GetTimeStampsRequest; ts.seriesList.Add(s); } return(ts); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { ofd.Filter = "PhysLogger Project Files (*.plprj)|*.plprj"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var data = System.IO.File.ReadAllLines(ofd.FileName); TimeSeriesCollection ts = null; try { completeLogControl.DataPort.Disconnect(); ts = TimeSeriesCollection.Deserialize(data); try { completeLogControl.dsCollectionForceSet = TimeSeriesCollection.Deserialize(data); } catch (Exception ex) { MessageBox.Show("PhysLogger has met an unexpected error. It will exit now. \r\n\r\nAdditional Information: " + ex.ToString()); Close(); } } catch (Exception ex) { MessageBox.Show("The selected file could not be parsed as a valid PhysLogger Project File.\r\n\r\nAdditional Information: " + ex.Message); } }
public void dsCollectionUpdated(TimeSeriesCollection dsCol) { dsCollection_ = dsCol; foreach (var log in SingleLogs) { log.dsCollectionUpdated(dsCol); } OverLappingLogs.dsCollectionUpdated(dsCol); }
public void UpdateChannelVisuals(TimeSeriesCollection value) { for (int i = 0; i < value.Count; i++) { ChannelEditors[i].Adapt(value[i]); dsCol[i].Adapt(value[i]); } // this will automatically look for disabled series and hide the respective panels. resetChannelEditorTops(); logControl.Invalidate(); }
public static string Serialize(TimeSeriesCollection ts) { StringBuilder sb = new StringBuilder(); sb.AppendLine(ts.UniqueXAxisStamps.ToString()); sb.AppendLine(ts.TimeStamps.Count.ToString()); foreach (var t in ts.TimeStamps) { sb.AppendLine(t.ToString()); } sb.AppendLine(ts.seriesList.Count.ToString()); foreach (var s in ts.seriesList) { sb.Append(s.Serialize()); } return(sb.ToString()); }
/// <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); } }
public virtual void dsCollectionUpdated(TimeSeriesCollection dsCol) { ts = dsCol.TimeStamps; }
public override void dsCollectionUpdated(TimeSeriesCollection dsCol) { base.dsCollectionUpdated(dsCol); dsCollection_ = dsCol; }