Пример #1
0
 public TrackForm(OBDInterface obd)
 {
     m_obdInterface = obd;
     timeslip       = new Timeslip {
         Vehicle = m_obdInterface.ActiveProfile.Name
     };
     InitializeComponent();
     CheckConnection();
 }
Пример #2
0
 private void btnReset_Click(object sender, EventArgs e)
 {
     m_bCapture       = false;
     btnStage.Enabled = true;
     StopTimer();
     timeslip = new Timeslip {
         Vehicle = m_obdInterface.ActiveProfile.Name
     };
     UpdateTimeslip();
 }
Пример #3
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Filter           = "结果文件 (*.slp)|*.slp",
                FilterIndex      = 0,
                RestoreDirectory = true
            };

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                XmlSerializer xmlSerializer = new XmlSerializer(timeslip.GetType());
                using (FileStream reader = new FileStream(openFileDialog.FileName, FileMode.Open)) {
                    timeslip = (Timeslip)xmlSerializer.Deserialize(reader);
                    reader.Close();
                }
                UpdateTimeslip();
            }
            openFileDialog.Dispose();
        }
Пример #4
0
        private void CalculateTimeslip()
        {
            double num1 = 0.0;
            double num2 = 0.0;
            bool   flag = false;

            timeslip = new Timeslip();
            if (m_KphValues == null || m_KphValues.Count == 0)
            {
                return;
            }
            timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
            timeslip.Date    = m_KphValues[0].Date;
            if (m_KphValues.Count <= 1)
            {
                return;
            }

            for (int i = 1; i < m_KphValues.Count; i++)
            {
                DatedValue datedValue1  = m_KphValues[i - 1];
                DatedValue datedValue2  = m_KphValues[i];
                double     num3         = (datedValue2.Value + datedValue1.Value) * 0.5 * (5.0 / 18.0);
                double     totalSeconds = datedValue2.Date.Subtract(datedValue1.Date).TotalSeconds;
                num1 += totalSeconds;
                double num4 = totalSeconds * num3;
                num2 += num4;
                if (num2 >= 18.288 && timeslip.SixtyFootTime == 0.0)
                {
                    timeslip.SixtyFootTime = num1 - (num2 - 18.288) / num3;
                    flag = true;
                }
                if (datedValue2.Value >= 96.56064 && timeslip.SixtyMphTime == 0.0)
                {
                    timeslip.SixtyMphTime = num1 - (datedValue2.Value - 96.56064) / ((datedValue2.Value - datedValue1.Value) / totalSeconds);
                    flag = true;
                }
                if (num2 >= 201.168 && timeslip.EighthMileTime == 0.0)
                {
                    double num5 = num2 - 201.168;
                    timeslip.EighthMileTime  = num1 - num5 / num3;
                    timeslip.EighthMileSpeed = ((datedValue2.Value - datedValue1.Value) * ((num4 - num5) / num4) + datedValue1.Value) * 0.621371192;
                    flag = true;
                }
                if (num2 >= 304.8 && timeslip.ThousandFootTime == 0.0)
                {
                    timeslip.ThousandFootTime = num1 - (num2 - 304.8) / num3;
                    flag = true;
                }
                if (num2 >= 402.336 && timeslip.QuarterMileTime == 0.0)
                {
                    double num5 = num2 - 402.336;
                    timeslip.QuarterMileTime  = num1 - num5 / num3;
                    timeslip.QuarterMileSpeed = ((datedValue2.Value - datedValue1.Value) * ((num4 - num5) / num4) + datedValue1.Value) * 0.621371192;
                    flag       = true;
                    m_bCapture = false;
                }
            }
            if (!flag)
            {
                return;
            }
            this.BeginInvoke((EventHandler) delegate {
                UpdateTimeslip();
            });
        }