Пример #1
0
        void AddResultDistance(SubMode subMode, string subModeUnit, string label, string modeUnit)
        {
            RunData    runData    = new RunData(mode);
            ResultMode resultMode = Tools.ToResultMode(mode);
            RunResult  runResult  = new RunResult(ResultMode.Distance);

            runData.Load(itemRun);
            runResult.Load();

            listViewItems.Add(new ResultItem(label + " (" + modeUnit + ")", ""));

            foreach (ResultItem input in runResult.Items)
            {
                ResultItem output = runData.GetResult(input, subMode, subModeUnit);
                listViewItems.Add(output);
                Debug.LogToFile("result " + mode + " (" + subMode + ")" + ": " + output.Left + " " + modeUnit + " = " + output.Right);
            }

            if (Config.Result.CalibrationLabelEnabled)
            {
                if (subMode == SubMode.TimeDistance)
                {
                    if (lblRunInfo.Text.Contains("Calibration") == false) // do not add this text twice
                    {
                        lblRunInfo.Text += Environment.NewLine + GetCalibrationRunInfo(runData);
                        Debug.LogToFile(runData.ToString()); // prints calibration from runAdjust
                    }
                }
            }
        }
Пример #2
0
        public void Reset()
        {
            stopWatch.Reset();
            accelerationFilter.Reset();

            isTargetReached = false;
            acceleration    = 0;
            speed           = 0;
            runCompleted    = false;

            accelerationProvider.SetDirection(true); // apply speed-up mode at sensor

            RunResult runResult = new RunResult(ResultMode.ZeroToZero);

            runResult.Load();
            speedTarget    = runResult.GetSpeedTargetMax();
            speedTargetMin = speedTarget * 0.5f;

            status = Localization.runModeWaitGreater;
            if (Settings.IsSpeedUnitKph())
            {
                status += " " + Tools.ToKilometerPerHour(speedTarget) + " " + Settings.GetSpeedUnit();
            }
            else
            {
                status += " " + Tools.ToMilesPerHour(speedTarget) + " " + Settings.GetSpeedUnit();
            }
        }
Пример #3
0
        void CreateResultTime(SubMode subMode, string subModeUnit, string label, string modeUnit)
        {
            RunData    runData    = new RunData(mode);
            ResultMode resultMode = Tools.ToResultMode(mode);
            RunResult  runResult  = new RunResult(resultMode);

            runData.Load(itemRun);
            runResult.Load();

            listViewItems = new List <ResultItem>();
            listViewItems.Add(new ResultItem(label + " (" + modeUnit + ")", ""));

            Debug.LogToFile("run [id, date, time]: " + itemRun.Id + " // " + itemRun.Date.ToString("dd MMMM yyyy") + " // " + itemRun.Date.ToString("HH:mm"));

            foreach (ResultItem input in runResult.Items)
            {
                ResultItem output = runData.GetResult(input, subMode, subModeUnit);
                listViewItems.Add(output);
                Debug.LogToFile("result " + mode + " (" + subMode + ")" + ": " + output.Left + " " + modeUnit + " = " + output.Right);
            }

            listView.ItemsSource = listViewItems;

            plotView.Update(runData, subMode);

            if (Config.Result.CalibrationLabelEnabled)
            {
                lblRunInfo.Text = Tools.RemoveTillEnd(lblRunInfo.Text, Environment.NewLine + "Peak Acceleration");
            }
        }
Пример #4
0
        void CreateRunResult()
        {
            if (runResult != null)
            {
                // save old mode to settings
                StoreRunResult();
            }

            runResult = new RunResult(mode);
            runResult.Load();

            runResult.CollectionChanged += OnCollectionChanged;
        }
Пример #5
0
        string GetShareText()
        {
            StringBuilder result = new StringBuilder();

            if (IsItemRunEmpty())
            {
                result.Append(Localization.pageResultEmpty);
            }
            else
            {
                string runResults = "";

                RunData    runData    = new RunData(mode);
                ResultMode resultMode = Tools.ToResultMode(mode);
                RunResult  runResult  = new RunResult(resultMode);

                runData.Load(itemRun);
                runResult.Load();

                runResults += GetShareTextForMode(runData, runResult, SubMode.TimeSpeed, Localization.unitSecond, Settings.GetSpeedUnit());
                if (mode.Equals("Acceleration"))
                {
                    runResults += GetShareTextForMode(runData, runResult, SubMode.TimeDistance, Localization.unitSecond, Settings.GetDistanceUnit());
                }
                runResults += GetShareTextForMode(runData, runResult, SubMode.Distance, Settings.GetDistanceUnit(), Settings.GetSpeedUnit());
                runResults += GetShareTextForMode(runData, runResult, SubMode.Height, Settings.GetDistanceUnit(), Settings.GetSpeedUnit());

                result.Append("Car Performance - Result").Append(Environment.NewLine);
                result.Append(Environment.NewLine);
                result.Append(Environment.NewLine);
                result.Append(GetRunInfo()).Append(Environment.NewLine);
                result.Append(Environment.NewLine);
                result.Append(runResults).Append(Environment.NewLine);
                result.Append(Environment.NewLine);

                if (Config.Result.ShareDetailsEnabled)
                {
                    result.Append(runData.GetEventsCommaSeparated());
                    result.Append(Environment.NewLine);
                }
            }

            return(result.ToString());
        }
Пример #6
0
        public void Reset()
        {
            status = Localization.runModeWait;

            stopWatch.Reset();
            accelerationFilter.Reset();

            timeSplit       = "0.00s";
            acceleration    = 0;
            speed           = 0;
            speedTargetLast = 0;

            RunResult runResult = new RunResult(ResultMode.Speed);

            runResult.Load();
            speedTargetMax = runResult.GetSpeedTargetMax();
            speedTargets   = runResult.GetSpeedTargets();

            accelerationProvider.SetDirection(true);
        }
Пример #7
0
        public void Reset()
        {
            stopWatch.Reset();
            accelerationFilter.Reset();

            isTargetMaxReached = false;
            acceleration       = 0;
            speed        = 0;
            runCompleted = false;

            RunResult runResult = new RunResult(ResultMode.Brake);

            runResult.Load();
            speedTargetMax = runResult.GetSpeedTargetMax();
            speedTargets   = runResult.GetSpeedTargets();
            speedTargetMin = speedTargets[0] * 0.5f; // index 0 is lowest target

            accelerationProvider.SetDirection(true); // apply speed-up mode at sensor

            string targets = "";

            foreach (float f in speedTargets)
            {
                if (Settings.IsSpeedUnitKph())
                {
                    targets += Tools.ToKilometerPerHour(f);
                }
                else
                {
                    targets += Tools.ToMilesPerHour(f);
                }
                targets += "/";
            }

            targets = Tools.ReplaceLastOccurrence(targets, "/", "");
            status  = Localization.runModeWaitGreater + " " + targets + " " + Settings.GetSpeedUnit();
        }