Exemple #1
0
 //Selection
 private void Bar_clb_SelectedIndexChanged(object sender, EventArgs e)
 {
     _curBarItem = Bar_clb.SelectedItem.ToString();
     int index = Bar_clb.FindString(_curBarItem);
     for (int i = 0; i < Bar_clb.Items.Count; i++)
     {
         if (index != i)
             Bar_clb.SetItemChecked(i, false);
     }
     SetBarInterval setbar = new SetBarInterval(_curBarItem);
 }
Exemple #2
0
 private void Start_btn_Click(object sender, EventArgs e)
 {
     if (Devices_clb.CheckedItems.Count == 0)
         return;
     if (GraphChart.Series != null && Stop_btn.Enabled == false)
     {
         for (int i = GraphChart.Series.Count-1; i >= 0; i--)
             GraphChart.Series.RemoveAt(i);
     }
     if (Stop_btn.Enabled == false)
     {
         SetBarInterval setbar = new SetBarInterval(_curBarItem);
         foreach (string devices in Devices_clb.CheckedItems)
         {
             Series serie = new Series(devices) { ChartType = SeriesChartType.Spline, BorderWidth = 3 };
             GraphChart.Series.Add(serie);
         }
         GraphChart.ChartAreas[0].AxisY.Maximum = setbar.Getbarval() > 0 ? setbar.Getbarval() : Double.NaN;
         GraphChart.ChartAreas[0].AxisY.Minimum = -1;
         GraphChart.ChartAreas[0].AxisX.Maximum = 5;
         GraphChart.ChartAreas[0].AxisX.Minimum = 0;
         GraphChart.ChartAreas[0].CursorX.Interval = 0.1;
         GraphChart.ChartAreas[0].CursorY.Interval = 0.1;
         //GraphChart.ChartAreas[0].AxisX.LabelStyle.Format = "mm:ss.fff";
         GraphChart.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
         GraphChart.ChartAreas[0].AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
         GraphChart.ChartAreas[0].AxisX.ScaleView.Position = 0;
         GraphChart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
         GraphChart.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = false;
         GraphChart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
         GraphChart.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = false;
     }
     DeviceBackGroundWorker.DeviceManualResetEvent.Reset();
     if(_stopwatch.Elapsed.Milliseconds>0)
         _stopwatch.Start();
     else
         _stopwatch.Restart();
     //_samplesPrSecTimer.Start();
     SamplePrSecTxtBox.Enabled = false;
     Bar_clb.Enabled = false;
     Devices_clb.Enabled = false;
     Start_btn.Enabled = false;
     Start_btn.Text = Resources.Form1_Start_btn_Click_Resume;
     Stop_btn.Enabled = true;
     Pause_Resume_btn.Enabled = true;
     GraphRemoveMouse();
 }