Exemplo n.º 1
0
 public TrackForm(OBDInterface obd)
 {
     thisForm         = this;
     m_obdInterface   = obd;
     timeslip         = new Timeslip();
     timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
     InitializeComponent();
     CheckConnection();
 }
Exemplo n.º 2
0
 private void btnReset_Click(object sender, EventArgs e)
 {
     m_bCapture       = false;
     btnStage.Enabled = true;
     TrackForm.StopTimer();
     timeslip         = new Timeslip();
     timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
     UpdateTimeslip();
 }
Exemplo n.º 3
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Timeslip files (*.slp)|*.slp";
            openFileDialog.FilterIndex      = 0;
            openFileDialog.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();
            }
        }
Exemplo n.º 4
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Timeslip files (*.slp)|*.slp";
            openFileDialog.FilterIndex      = 0;
            openFileDialog.RestoreDirectory = true;
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            XmlSerializer xmlSerializer = new XmlSerializer(timeslip.GetType());
            FileStream    fileStream    = new FileStream(openFileDialog.FileName, FileMode.Open);

            timeslip = (Timeslip)xmlSerializer.Deserialize((Stream)fileStream);
            fileStream.Close();
            UpdateTimeslip();
        }
Exemplo n.º 5
0
        private void CalculateTimeslip()
        {
            double num1 = 0.0;
            double num2 = 0.0;
            bool   flag = false;

            timeslip         = new Timeslip();
            timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
            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;
            }

            int index = 1;

            do
            {
                DatedValue datedValue1  = m_KphValues[index - 1];
                DatedValue datedValue2  = m_KphValues[index];
                double     num3         = (datedValue2.Value + datedValue1.Value) * 0.5 * (5.0 / 18.0);
                DateTime   dateTime     = datedValue1.Date;
                double     totalSeconds = datedValue2.Date.Subtract(dateTime).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;
                }
                ++index;
            }while (index < m_KphValues.Count);
            if (!flag)
            {
                return;
            }
            UpdateTimeslip();
        }