hawkeye camera support(not tested)
This commit is contained in:
@@ -90,8 +90,9 @@ namespace Hawkeye.VisionBuilder.Workflow
|
||||
{
|
||||
return Regex.Replace(typeName.Replace("Operation", ""), "(\\B[A-Z]+?(?=[A-Z][^A-Z])|\\B[A-Z]+?(?=[^A-Z]))", (useSpaces?" ":"")+"$1");
|
||||
}
|
||||
|
||||
[NotForTool]
|
||||
public bool Result { get; set; } = true;
|
||||
[NotForTool]
|
||||
public string ResultString
|
||||
{
|
||||
get
|
||||
@@ -104,7 +105,12 @@ namespace Hawkeye.VisionBuilder.Workflow
|
||||
[NotForTool]
|
||||
public string Label { get; set; }
|
||||
|
||||
[NotForTool]
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[NotForTool]
|
||||
public TimeSpan ExecutionTime { get; set; }
|
||||
[NotForTool]
|
||||
public string ExecutionTimeString
|
||||
{
|
||||
get
|
||||
@@ -132,7 +138,7 @@ namespace Hawkeye.VisionBuilder.Workflow
|
||||
public Dictionary<string, object> GetParameters()
|
||||
{
|
||||
|
||||
var props = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
|
||||
var props = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(x=>!x.HasAttribute(typeof(NotForToolAttribute)));
|
||||
return props.ToDictionary(x => x.Name, x => x.GetValue(this)!);
|
||||
}
|
||||
@@ -142,7 +148,7 @@ namespace Hawkeye.VisionBuilder.Workflow
|
||||
foreach (KeyValuePair<string, object> pair in parameters)
|
||||
{
|
||||
this.GetType().GetProperty(pair.Key,
|
||||
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
|
||||
BindingFlags.Public | BindingFlags.Instance )
|
||||
?.SetValue(this,pair.Value);
|
||||
}
|
||||
}
|
||||
@@ -275,6 +281,23 @@ namespace Hawkeye.VisionBuilder.Workflow
|
||||
Label = br.ReadString();
|
||||
}
|
||||
|
||||
public virtual void Save(Dictionary<string, object> dict)
|
||||
{
|
||||
dict[nameof(Id)] = Id.ToString();
|
||||
dict[nameof(Label)] = Label;
|
||||
dict[nameof(Enabled)] = Enabled;
|
||||
}
|
||||
|
||||
public virtual void Load(Dictionary<string, object> dict)
|
||||
{
|
||||
if (dict.ContainsKey(nameof(Id)))
|
||||
Id = new Guid(dict[nameof(Id)].ToString());
|
||||
if (dict.ContainsKey(nameof(Label)))
|
||||
Label = dict[nameof(Label)].ToString();
|
||||
if (dict.ContainsKey(nameof(Enabled)))
|
||||
Enabled = Convert.ToBoolean(dict[nameof(Enabled)]);
|
||||
}
|
||||
|
||||
public void SetError(string eMessage)
|
||||
{
|
||||
Status=eMessage;
|
||||
|
||||
Reference in New Issue
Block a user