public IConnection createFromXML(XmlTextReader aXMLTextReader)
        {
            Connection lConnection          = new Connection();
                XMLAttributeReader lReader      = new XMLAttributeReader(aXMLTextReader);

                lConnection.mInstanceNumber     = lReader.getAttribute<UInt32>("InstanceNumber", lConnection.mInstanceNumber);
                lConnection.mContinuousScan     = lReader.getAttribute<Boolean>("ContinuousScan", lConnection.mContinuousScan);
                lConnection.Slowdown            = lReader.getAttribute<UInt32>("Slowdown", lConnection.Slowdown);

                return lConnection;
        }
 public IConnection createByForm(IWin32Window aOwner)
 {
     Connection lConnection = new Connection();
         using (var lSetupForm = new ConnectionSetupForm(lConnection, true))
         {
             if (lSetupForm.ShowDialog(aOwner) == DialogResult.Cancel)
             {
                 if (lConnection.Connected)
                 {
                     lConnection.disconnect();
                 }
                 lConnection.Dispose();
                 lConnection = null;
             }
         }
         return lConnection;
 }
        public ItemSetupForm(Connection aConnectionS7PLCSim, DataItem aItemS7PLCSim)
        {
            mConnectionS7PLCSim = aConnectionS7PLCSim;
            InitializeComponent();

            MemoryType  = aItemS7PLCSim.mMemoryType;
            DataType    = aItemS7PLCSim.DataType;
            DB          = aItemS7PLCSim.DB;
            Bit         = aItemS7PLCSim.Bit;
            Byte        = aItemS7PLCSim.Byte;
            Signed      = aItemS7PLCSim.Signed;
            FloatingP   = aItemS7PLCSim.FloatingP;
            Length      = aItemS7PLCSim.Length;

            mConnectionS7PLCSim.ConnectionState += new EventHandler(onChange);
            updateForm();
        }
        public ConnectionSetupForm(Connection aConnectionS7PLCSim, bool aNew)
        {
            mConnectionS7PLCSim = aConnectionS7PLCSim;
            InitializeComponent();

            if (aNew == false)
            {
                okCancelButton.setOkOnlyStyle();
            }

            mConnectionS7PLCSim.ConnectionState += new EventHandler(onConnectionState);
            mConnectionS7PLCSim.ConnectionError += new EventHandler<MessageStringEventArgs>(onConnectionError);
            updateForm();
            cycUpdate();

            mCyclicUpdateTimer          = new System.Timers.Timer(MiscUtils.SlowFormUpdateTime);
            mCyclicUpdateTimer.Elapsed  += new ElapsedEventHandler(CyclicUpdate);
            mCyclicUpdateTimer.Start();
        }