they should be a bunch of properties or a collection). Settings maybe
readonly or read write. I have a "monitor" that polls the (actual
physical) device periodically to detect changes in settings. These
changes should be reflected in my device instance. Any changes to the
device state should be reflected in the physical device. Should also
be able to add and remove settings at runtime.
The goal is to be able to access these objects on a commandline (by
launching an Ironpython interactive session and loading the assembly)
like so...
print Device1.setting1If I define all the settings as properties in Device. I have a simple
Device1.setting1 = <some value>
Device1.add(newsetting)
Device1.newsetting = <some value>
way of getting and setting their values on the commandline. With tab
completion enabled on the commandline, its a very convenient method of
getting and setting values.
The problem is I dont see how I can add new settings (or remove
settings) without replacing the properties with a collection
(arraylist or hastable). But this would break the simple way to access
info on the command line.
It would change to
print Device1.settings["setting1"]The user would have to know what settings are available.
Device1.settings["setting1"] = <value>
Being new to C#, was wondering if there is some mechanism through
which I could preserve the original way of interacting on the console
and be able to add remove settings???
My second problem:
Device1.setting1 can be changed by the user OR may change on the
device (due to reasons other than a user making changes)
So I have two ways of changing a setting
OnUserChange
set{
_setting = sendToPhysicalDevice(value)
if(_setting == error)
_setting = null
}
OnChangeInDevice
_setting = value from poller
So I have a feeling I cant use C# Properties to describe my device
settings, which means again I cant support the kind of console
interaction I want to provide.
Or is there some way I can get this to work? If you have got this far,
thank you for your patience and any advise or suggestions would be
greatly appreciated