init
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
namespace DatabaseExport
|
||||
{
|
||||
public class ZeroMethod //: INotifyPropertyChanged
|
||||
{
|
||||
public Test.Module.Channel.Sensor.ZeroMethodType Method { get; set; }
|
||||
|
||||
public double Start { get; set; }
|
||||
|
||||
public double End { get; set; }
|
||||
|
||||
public ZeroMethod(Test.Module.Channel.Sensor.ZeroMethodType zm, double _start, double _end)
|
||||
{
|
||||
Method = zm;
|
||||
Start = _start;
|
||||
End = _end;
|
||||
}
|
||||
public ZeroMethod(string zm)
|
||||
{
|
||||
Initialize(zm, System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
/// <summary>
|
||||
/// do a deep copy
|
||||
/// </summary>
|
||||
/// <param name="copy"></param>
|
||||
public ZeroMethod(ZeroMethod copy)
|
||||
{
|
||||
Method = copy.Method;
|
||||
Start = copy.Start;
|
||||
End = copy.End;
|
||||
}
|
||||
private void Initialize(string zm, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var tokens = zm.Split(',');
|
||||
if (tokens.Length < 3) { return; }
|
||||
Start = Convert.ToDouble(tokens[1], culture);
|
||||
End = Convert.ToDouble(tokens[2], culture);
|
||||
Method = (Test.Module.Channel.Sensor.ZeroMethodType)
|
||||
Enum.Parse(typeof(Test.Module.Channel.Sensor.ZeroMethodType), tokens[0]);
|
||||
}
|
||||
public string ToDbString()
|
||||
{
|
||||
return string.Format("{0},{1},{2}", Method.ToString(), Start, End);
|
||||
}
|
||||
public string ToSerializeString()
|
||||
{
|
||||
return string.Format("{0},{1},{2}",
|
||||
Method.ToString(),
|
||||
Start.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
End.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user