private void ComboBoxTraceEventFiltersSelectionChangeCommitted(object sender, EventArgs e) { CurrentSelectedClass = comboBoxClass.SelectedItem; CurrentSelectedSubclass = comboBoxSubclass.SelectedItem; var currentComboBox = sender as ComboBox; if (currentComboBox == comboBoxClass) { RefreshSubclassFilter(); } var query = CurrentExecutionResult.Profilers .SelectMany((p) => p.ToList()); if (comboBoxClass.Text != ParameterDefaultValue) { query = query.Where((p) => p.EventClass.Value == comboBoxClass.Text.ToEventClass()); } if (comboBoxSubclass.Text != ParameterDefaultValue) { query = query.Where((p) => p.EventSubclass.HasValue && p.EventSubclass.Value == comboBoxSubclass.Text.ToEventSubclass()); } query = query.OrderBy((p) => p.ID) .ToSortableBindingList(); CurrentDataGridView.DataSource = null; CurrentDataGridView.DataSource = query; CurrentDataGridView.HideEmptyColumns(); UpdateLabelMessage(); }
/// <summary> /// Handles the Tick event of the timer1 control. Each step either checks the notify arrays if in Synchronous mode. If in Async... /// it simply steps. At each step, the function checks for triggers (repeat the script), changes the ouput if commanded by script, stores and plots the data. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void MainTimer_Tick(object sender, EventArgs e) { if ((StartFileNotify.Count != 0)) { string S; while (!StartFileNotify.TryTake(out S)) { ; } PopulateStartFile(S); } if ((TimeStepNotify.Count != 0) || (AreWeSyncing == SyncType.ASynchronous)) { int a; TimeStepNotify.TryTake(out a); double SecsNow = 0; Setpoints Current = new Setpoints(0, 0); if (TriggerNotify.Count > 0) { Triggered = true; TriggerTime = DateTime.Now; TriggerNotify.Take(); } if (ContRepeatRadioButton.Checked)//todo you stopped here. need to add triggering { SecsNow = ((DateTime.Now - StartTime).TotalSeconds); Current = SetpointList.Last(x => (SecsNow % (SetpointList[SetpointList.Count - 1].Sec + SecsOnEnd)) >= x.Sec); if (Current == null) { Current = SetpointList[SetpointList.Count - 1]; } } else if (TrigRepeatRadioButton.Checked) { SecsNow = ((DateTime.Now - TriggerTime).TotalSeconds); Current = SetpointList.Last(x => (SecsNow) >= x.Sec); if (Current == null) { Current = SetpointList[SetpointList.Count - 1]; } } else { } if (!FirstMeas) { LoadDataToTable(); if (((Results.Rows.Count % 5) == 0)) { ResultsChart.Series["Current"].Points.AddXY( Results.Rows[Results.Rows.Count - 1]["Time (s)"], Results.Rows[Results.Rows.Count - 1]["Current"] ); CurrentValsList[0].Value = Convert.ToDouble(Results.Rows[Results.Rows.Count - 1]["Current"]); for (int count = 0; count < (AD7124_8.ReadDataTemplate.Count - 1); count++) { ResultsChart.Series["Ch" + count + " Res"].Points.AddXY( Results.Rows[Results.Rows.Count - 1]["Time (s)"], Convert.ToDouble(Results.Rows[Results.Rows.Count - 1]["Ch" + count + " Res"]) / Convert.ToDouble(Results.Rows[1]["Ch" + count + " Res"]) ); CurrentValsList[count + 1].Value = Convert.ToDouble(Results.Rows[Results.Rows.Count - 1]["Ch" + count + " Res"]); } CurrentDataGridView.Refresh(); } } else { FirstMeas = false; } if (Current.Val != CurrentNow_uA) { AD7124_8.SendVal(Current.Val); CurrentNow_uA = Current.Val; Thread.Sleep(10); } //Asks for a result bur doesn't wait for it. Otherwise most of the program's time would be just waiting. AD7124_8.KickOffRead(); MostRecent = DateTime.Now; //Thread.Sleep(20); } }