void Start_Button_Click(object sender, RoutedEventArgs e) { trans_fpga = 0; trans_cpu = 0; baseDateCpu = new DateTime(0); baseDateFpga = new DateTime(0); resumebutton.IsEnabled = true; stopbutton.IsEnabled = true; started = true; FpgaValues.Clear(); CpuValues.Clear(); cpuQueue = new Queue <Data>(dataHandler.GetCpuResults()); fpgaQueue = new Queue <Data>(dataHandler.GetFpgaResults()); timerCpu = new DispatcherTimer(); timerCpu.Interval = TimeSpan.FromMilliseconds(1); timerFPGA = new DispatcherTimer(); timerFPGA.Interval = TimeSpan.FromMilliseconds(1); timerCpu.Tick += timerCpu_Tick; timerCpu.Start(); timerFPGA.Tick += timerFPGA_Tick; //Console.WriteLine("Today is"); string accur = DataHandler.GetAccuracy(); //Console.WriteLine("got here"); //Console.WriteLine(accur); string[] result = accur.Split('\\'); accuracy.Text = result[0]; timerFPGA.Start(); }
void timerFPGA_Tick(object sender, EventArgs e) { if (fpgaQueue.Count == 0) { timerFPGA.Stop(); } timerFPGA.Stop(); try { trans_fpga++; Data dataPoint = fpgaQueue.Dequeue(); stock_fpga.Text = dataPoint.ExpandedData.Stock_Id.ToString(); fairprice_fpga.Text = dataPoint.FairPrice.ToString(); time_fpga.Text = dataPoint.Time.ToString(); transaction_fpga.Text = trans_fpga.ToString(); expiry_fpga.Text = dataPoint.ExpandedData.Expiry.ToString(); callput_fpga.Text = dataPoint.ExpandedData.Call_Put.ToString(); //Plot point timerFPGA.Interval = dataPoint.TimeDiff; DateTime newTime = baseDateCpu.Add(dataPoint.Time); baseDateFpga = baseDateFpga.Add(dataPoint.Time); DateModel dtpoint = new DateModel { DateTime = newTime, Value = trans_fpga }; FpgaValues.Add(dtpoint); timerFPGA.Start(); } catch { timerFPGA.Stop(); } }