I'm now trying to develop this with iX 2.0, for now - just testing to see if I can store an operators trends and bring them back up to read the values.
What I've done is that I've stored the following lines in a text document;
Code:
Globals.Tags.Trend11.Value
Globals.Tags.Trend12.Value
Globals.Tags.Trend13.Value
Now, when reading the text file into an array and put them in an AnalogNumeric foreach line, I get the correct tag. But it does not seem like the application understands that it is a tag?
Code:
void Button1_Click(System.Object sender, System.EventArgs e)
{
string trendpen;
string filePath = "";
string line;
List<String> stringArr = new List<string>();
try
{
trendpen = this.ComboBox1.SelectedItem.ToString();
filePath = @"" + trendpen + "";
}
catch
{
MessageBox.Show("Finner ikke angitt trend-fil. Velg fra nedtreksmenyen", "Feil i valg av trend", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
if (File.Exists( filePath ))
{
StreamReader file = null;
try
{
file = new StreamReader( filePath );
while ((line = file.ReadLine()) != null)
{
stringArr.Add(line);
}
}
finally
{
if (file != null)
file.Close();
}
}
else
{
MessageBox.Show("Finner ikke angitt trend-fil. Velg fra nedtreksmenyen", "Feil i valg av trend", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
if(stringArr.Count >= 1)
{
AnalogNumeric1.Value = stringArr[0];
}
if(stringArr.Count >= 2)
{
AnalogNumeric2.Value = stringArr[1];
}
if(stringArr.Count >= 3)
{
AnalogNumeric3.Value = stringArr[2];
}
}
Maybe there is a functionality in 2.0 that does this for me, and also gives the oportunity to fetch "history" values as well?