init
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
public class ZeroMethod : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)
|
||||
{
|
||||
if (Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
protected void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public ZeroMethodType Method { get; set; }
|
||||
|
||||
public double Start { get; set; }
|
||||
|
||||
public double End { get; set; }
|
||||
public ZeroMethod(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 = (ZeroMethodType)Enum.Parse(typeof(ZeroMethodType), tokens[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user