Ejemplo n.º 1
0
        private string GetPreviousSegmentDeltaString()
        {
            string segmentDeltaString;
            double segmentDelta;
            bool   lostTime;
            bool   bestSegment = false;
            double timeElapsed = (Math.Truncate(segmentWatch.Elapsed.TotalSeconds * 100) / 100) + timeElapsedSinceSplit;

            if (split.LiveIndex > 0)
            {
                bestSegment = split.PreviousSegmentIsBestSegment();
            }
            if (split.CurrentSegmentHasLiveDelta(timeElapsed))
            {
                informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText = "Live segment: ";
                segmentDelta       = split.GetLiveSegmentDelta(timeElapsed);
                segmentDeltaString = FaceSplitUtils.TimeFormat(Math.Abs(segmentDelta));
                lostTime           = (segmentDelta > 0);
                if (lostTime)
                {
                    informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaLostColor;
                    segmentDeltaString = segmentDeltaString.Insert(0, "+");
                    segmentWatchColor  = SettingsLayout.Default.SegmentTimerLosingTimeColor;
                }
                else
                {
                    informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaSavedColor;
                    segmentDeltaString = segmentDeltaString.Insert(0, "-");
                }
            }
            else if (split.PreviousSegmentHasSegmentDelta())
            {
                informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText = "Previous segment: ";
                segmentDelta       = split.GetPreviousSegmentDelta();
                segmentDeltaString = FaceSplitUtils.TimeFormat(Math.Abs(segmentDelta));
                lostTime           = (segmentDelta > 0);
                if (bestSegment)
                {
                    informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaBestSegmentColor;
                    segmentDeltaString = segmentDeltaString.Insert(0, "-");
                }
                else
                {
                    if (lostTime)
                    {
                        informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaLostColor;
                        segmentDeltaString = segmentDeltaString.Insert(0, "+");
                    }
                    else
                    {
                        informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaSavedColor;
                        segmentDeltaString = segmentDeltaString.Insert(0, "-");
                    }
                }
                split.SetPreviousSegmentColor(bestSegment, lostTime);
            }
            else
            {
                informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText        = "Previous segment: ";
                informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = SettingsLayout.Default.PreviousSegmentDeltaNoDeltaColor;
                segmentDeltaString = "-";
            }
            segmentDeltaString = FaceSplitUtils.CutDecimals(segmentDeltaString, 2);
            return(segmentDeltaString);
        }