c# - How to approach building an expression/condition evaluator GUI? -
i have winforms application connected database contains huge amount of measurement data of different datapoints. data gets updated every few seconds, old values go archive table etc. i'm using ef6 data access.
now need build gui offers functionality follows:
the user should able define conditions and/or expressions @ runtime trigger actions when true. example in pseudo-code:
if ([value of datapoint 203] >= 45 , (timestamp of datapoint 203 < "07:00am") , (([value of datapoint 525] == 1]) or ([value of datapoint 22] < 0)]) set [value of datapoint 1234] ([value of 203]/4) //or call method alternatively
or simpler example in natural language (differs above):
if cold , raining, turn on machine xy
where cold , raining values of datapoints , turn on machine
method given parameter xy.
these expressions need saved , evaluated in regular intervals of minutes or hours. did not face such requirement before , hardly know start. best practice? there maybe sample code know of? or there controls or libraries this?
update: breaking down more specific:
suppose have class this:
class datapoint { public int id { get; set; } public datetime timestamp { get; set; } public int value { get; set; } }
during runtime have 2 objects of type, datapointa
, datapointb
. want enter following textbox , click button:
datapointa.value>5 && ( datapointb.value==2 || datapointb.value==7 )
depending on actual values of these objects, want evaluate expression string , true or false. possible?
Comments
Post a Comment