1

I am really new in programming with c# and am creating an application object for ArchestrA IDE from Wonderware.

I want to make a tabpage with a list of checkboxes which is created based on a list of objects in configtime but i don't know how to pass this list from configtime to editor.

Here is an extract of the code:

Code in Configtime:

public class Surveillance_AppConfigtime : ConfigtimeBase
{ 
    public List<Primitive> _tEnginePrimitives;

    private void Surveillance_AppConfigtime_ConfigtimeInitialize(object sender)
    {
    _tEnginePrimitives = new List<Primitive>();

    _tEnginePrimitives.Add(new Primitive("Scheduler.ScanCyclesCnt", MxDataType.MxInteger));
    _tEnginePrimitives.Add(new Primitive("Scheduler.ScanOverrunsCnt", MxDataType.MxInteger));
    _tEnginePrimitives.Add(new Primitive("Scheduler.ScanOverrunsConsecCnt", MxDataType.MxInteger));
    _tEnginePrimitives.Add(new Primitive("Scheduler.ScanPeriod", MxDataType.MxInteger));
    _tEnginePrimitives.Add(new Primitive("Scheduler.TimeIdleAvg", MxDataType.MxInteger));
    _tEnginePrimitives.Add(new Primitive("Engine.ProcessCPULoad", MxDataType.MxInteger,true));
    _tEnginePrimitives.Add(new Primitive("ScanState", MxDataType.MxBoolean));
    }
}

Code in Editor:

public partial class Surveillance_AppEditor : ArchestraEditorFramework.aaBaseEditorForm
{
    TabPage enginePage = new TabPage("Engine");
    CheckBox _cb = new CheckBox();
    private int y = 0;

    public Surveillance_AppEditor()
    {   
        //enginePage

        foreach (Primitive oPrimitive in _tEnginePrimitives)
        {
            _cb = new CheckBox();
            _cb.Location = new Point(10, y);
            _cb.Name = oPrimitive.Name;
            platformPage.Controls.Add(_cb);
            y += 15;
        }
        MainTabControl.TabPages.Add(enginePage);
    }
}

Hope anyone can help me please. Thank you in advance!

Gareth
  • 2,746
  • 4
  • 30
  • 44
TDrought
  • 11
  • 3
  • Does this compile? _tEnginePrimitives is defined in `Surveillance_AppConfigtime` but you appear to be trying to iterate through it in `Surveillance_AppEditor` – Gareth Jun 05 '14 at 11:40
  • @Gareth yes, it does compile without errors but it does show the same value in Editor as in Configtime. But I've solved this problem by creating a common reference between the two and adding a Singleton to ensure a single instance. :) – TDrought Jun 06 '14 at 07:14

0 Answers0