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(); }
public ConfigForm(Mux mux, Demux demux, MasterPort masterPort, List <SlavePort> slavePorts) { this.mux = mux; this.demux = demux; this.slavePortsList = slavePorts; this.masterPort = masterPort; InitializeComponent(); }
public Mux(MasterPort masterPort) { this.masterPort = masterPort; uploadPacketBackgroundWorker = new System.ComponentModel.BackgroundWorker(); uploadPacketBackgroundWorker.WorkerSupportsCancellation = true; uploadPacketBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.uploadPacketBackgroundWorker_DoWork); uploadPacketBackgroundWorker.RunWorkerAsync(); lPacketsToUpload = new List <string>(); }
public Demux(MasterPort masterPort) { this.masterPort = masterPort; lPacketsToDownload = new List <Packet>(); downloadPacketsBackgroundWorker = new System.ComponentModel.BackgroundWorker(); downloadPacketsBackgroundWorker.WorkerSupportsCancellation = true; processReceivedPacketsBackgroundWorker = new System.ComponentModel.BackgroundWorker(); processReceivedPacketsBackgroundWorker.WorkerSupportsCancellation = true; downloadPacketsBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.downloadPacketsBackgroundWorker_DoWork); processReceivedPacketsBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.processReceivedPacketsBackgroundWorker_DoWork); // Start the packets doxnloading thread downloadPacketsBackgroundWorker.RunWorkerAsync(); }