for simplicity you have 2 function:
Serialize(int T1target){}
and int T1Target=Deserialize(){}
Serialize writes the parameter to some file and Deserialize() reads it back in. For simplicity here the variable is a single int. In reality you would serialize your whole strategy class MyStrategy : Strategy
By setting the [XmlIgnore] attribute you define which parameters to save.
You should find examples on XmlSerialize functions either in the forum or on MSDN site or some other C# site.
Ok.
Once you have the Serialize and Deserialize which dipend on your parameters
then put
Dispose(){
Serialize()
... other stuff
base.Dispose();
}
in your class to automatically save the parameters
you do then:
[Description("Target 1in ticks")]
[Gui.Design.DisplayName("\tT1 Target")]
[Category("Parameters")]
public int T1_Target
{
get { return t1; }
set {
value=Deserialize(); // instead from GUI you read in value from your file
// this should work as the get function is called later from the GUI
//(to show in the properties box)
t1 = Math.Max(1, value);
}
}
be careful with Deserialize,as it might be called when Initialize() is not yet called, so you are restricted concerning access to class variables. check the log etc
regards
andreas
Comment