init
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* DTS.Slice.Control.DAS.Channel.IFilterable.cs
|
||||
*
|
||||
* Copyright © 2009
|
||||
* Diversified Technical Systems, Inc.
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DTS.Slice.Control.DAS.Channel
|
||||
{
|
||||
/// <summary>
|
||||
/// Methodical definition of a filterable slice control event module channle.
|
||||
/// </summary>
|
||||
public interface IFilterable
|
||||
//: DTS.Common.DAS.ConceptsIFilterable<Event.Module.Channel, short[]>
|
||||
{
|
||||
/// <summary>
|
||||
/// Get/set the <see cref="bool"/> switch to (de)activate filter caching.
|
||||
/// </summary>
|
||||
bool UseFilterCaching
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of available filters for this object.
|
||||
/// </summary>
|
||||
List<IFilter> AvailableFilters
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The currently applied filter.
|
||||
/// </summary>
|
||||
IFilter CurrentFilter
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the specified filtering for this object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">
|
||||
/// The <see cref="DTS.Slice.Control.CAS.Channel.IFilter"/> to be applied to this object.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="displayUnits">
|
||||
/// Choose the output <see cref="DTS.Slice.Control.DAS.Channel.Data.DisplayUnits"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// An array of <see cref="double"/> data reflecting the specified parameters.
|
||||
/// </returns>
|
||||
///
|
||||
double[] GetDataFilteredBy(IFilter filter, Event.Module.Channel.DataDisplayUnits displayUnits);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DTS.Serialization.TDM
|
||||
{
|
||||
public partial class TDMParameterDlg : Form
|
||||
{
|
||||
private readonly double _min;
|
||||
private readonly double _max;
|
||||
protected TDMParameterDlg()
|
||||
{
|
||||
}
|
||||
public TDMParameterDlg(string testName, double testStart, double testEnd)
|
||||
{
|
||||
InitializeComponent();
|
||||
DialogResult = DialogResult.Cancel;
|
||||
var di = new System.IO.DirectoryInfo(Properties.Settings1.Default.TDMFolder);
|
||||
if (!di.Exists)
|
||||
{
|
||||
di.Create();
|
||||
}
|
||||
var path = System.IO.Path.Combine(di.FullName, string.Format("{0}.csv", testName));
|
||||
tbLocation.Text = path;
|
||||
//tbStart.Text = (testStart*1000D).ToString();
|
||||
//tbStop.Text = (testEnd*1000D).ToString();
|
||||
var start = testStart * 1000D;
|
||||
var stop = testEnd * 1000D;
|
||||
_min = start;
|
||||
_max = stop;
|
||||
if (Properties.Settings1.Default.DefaultStart < start) { tbStart.Text = start.ToString(); }
|
||||
else { tbStart.Text = Properties.Settings1.Default.DefaultStart.ToString(); }
|
||||
|
||||
if (Properties.Settings1.Default.DefaultStop > stop) { tbStop.Text = stop.ToString(); }
|
||||
else { tbStop.Text = Properties.Settings1.Default.DefaultStop.ToString(); }
|
||||
}
|
||||
|
||||
private void btnBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var dlg = new SaveFileDialog())
|
||||
{
|
||||
dlg.Filter = "TDM CSV (*.csv)|*.csv";
|
||||
dlg.FilterIndex = 0;
|
||||
dlg.RestoreDirectory = true;
|
||||
dlg.OverwritePrompt = true;
|
||||
|
||||
var fi = new System.IO.FileInfo(tbLocation.Text);
|
||||
dlg.InitialDirectory = fi.Directory.FullName;
|
||||
dlg.FileName = tbLocation.Text;
|
||||
|
||||
if (DialogResult.OK == dlg.ShowDialog(this))
|
||||
{
|
||||
tbLocation.Text = dlg.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
errorProvider1.SetError(tbStart, null);
|
||||
errorProvider1.SetError(tbStop, null);
|
||||
var fi = new System.IO.FileInfo(tbLocation.Text);
|
||||
Properties.Settings1.Default.TDMFolder = fi.Directory.FullName;
|
||||
|
||||
var dstart = double.MinValue;
|
||||
if (double.TryParse(tbStart.Text, out dstart))
|
||||
{
|
||||
Properties.Settings1.Default.DefaultStart = dstart;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorProvider1.SetError(tbStart, "Could not parse");
|
||||
return;
|
||||
}
|
||||
var dend = double.MinValue;
|
||||
if (double.TryParse(tbStop.Text, out dend))
|
||||
{
|
||||
Properties.Settings1.Default.DefaultStop = dend;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorProvider1.SetError(tbStop, "Could not parse");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dend < dstart) { errorProvider1.SetError(tbStart, "Start must be before end"); return; }
|
||||
if (dend > _max) { errorProvider1.SetError(tbStop, string.Format("exceeds max data in test ({0} ms)", _max)); return; }
|
||||
if (dstart < _min) { errorProvider1.SetError(tbStart, string.Format("test does not contain requested region, min start is ({0} ms)", _min)); return; }
|
||||
|
||||
Properties.Settings1.Default.Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
public string FileName => tbLocation.Text;
|
||||
|
||||
public double Start => double.Parse(tbStart.Text) / 1000D;
|
||||
public double Stop => double.Parse(tbStop.Text) / 1000D;
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user