public MainWindow() { InitializeComponent(); //Initialize the classes this.pigetter = new piGetter(); this.rtusender = new rtuSender(); this.im = new InterruptManager(); //Replace this with the value retrieved from the Sampling Time textbox this.samplingInterval = new TimeSpan(0, 5, 0); //What is the current start time //initialize parameters here this.startDateTime = DateTime.Now.AddHours(-1.00); this.endDateTime = DateTime.Now; StartTimePicker.DefaultValue = startDateTime; EndTimePicker.DefaultValue = endDateTime; pigetter.setStartDateTime(this.startDateTime.ToString()); pigetter.setEndDateTime(this.endDateTime.ToString()); //reference to the csvOutuput this.csvOutput = new csvOuptut(); }
//Function to send to RTU public void sendToRTU() { buildMasterList(); //write to csv file here csvOuptut csvoutput = new csvOuptut(); csvoutput.createFile(this.masterList); csvoutput.openFile(); foreach (List <String[]> tempList in this.masterList) { Console.WriteLine(tempList); //Start threading here String dnpTag = this.piToDNPDict[tempList[0][0]]; Console.WriteLine(dnpTag); String ipAddress = this.ipAddressDict[dnpTag]; String siteName = this.siteDict[dnpTag]; int indexNumber = this.dnpIndexDict[dnpTag]; Thread t = new Thread(() => packageData(ipAddress, indexNumber, dnpTag, siteName, tempList)); t.Start(); /* * TODO: * - Start thread with the six parmameters */ } }