示例#1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Instanciate master port
            masterPort = new MasterPort();
            // Instanciate the DEMUX
            demux = new Demux(masterPort);
            // Share the Demux instance with MasterPort
            masterPort.SetDemux(demux);
            // Instanciate the MUX
            mux = new Mux(masterPort);
            // Restore the saved settings
            try
            {
                Settings.Default.Reload();
            }
            catch (Exception ex)
            {
                TraceLogger.ErrorTrace(ex.Message);
            }
            // Load master port saved config
            LoadMasterPort();
            // Load the saved slave port list
            LoadSlavePortsList();
            // Share the  slave port list with the demux
            demux.SetSlavePortList(slavePortsList);

            // Display the ports status
            SetupPortsListBoxes();
        }
示例#2
0
 public ConfigForm(Mux mux, Demux demux, MasterPort masterPort, List <SlavePort> slavePorts)
 {
     this.mux            = mux;
     this.demux          = demux;
     this.slavePortsList = slavePorts;
     this.masterPort     = masterPort;
     InitializeComponent();
 }
示例#3
0
 public SlavePort(Mux mux)
 {
     this.mux      = mux;
     serialPort    = new SerialPort();
     this.linkType = LinkType.Ascii;
     dataReceptionBackgroundWorker = new BackgroundWorker();
     dataReceptionBackgroundWorker.WorkerSupportsCancellation = true;
     dataReceptionBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.dataReceptionBackgroundWorker_DoWork);
     this.timerPacketTimeout       = new System.Windows.Forms.Timer();
     this.timerPacketTimeout.Tick += new System.EventHandler(this.timerPacketTimeout_Tick);
 }