private void StopWatch_Lap_Click(object sender, EventArgs e) { string saveLaps = string.Empty; string saveSplits = string.Empty; StopwatchTimes stopwatchTimes = new StopwatchTimes(); stopwatchTimes.ItemCount = StopwatchTimesCollection.Count + 1; stopwatchTimes.SplitTime = ClockValueString; stopwatchTimes.LapTime = (ClockValue - _lastSplitTime).ToString(@"hh\:mm\:ss\.ff"); StopwatchTimesCollection.Insert(0, stopwatchTimes); _lastSplitTime = ClockValue; saveSplits = GetSplitData(","); IS.SaveSetting("Stopwatch-Splits", saveSplits); saveLaps = GetLapData(","); IS.SaveSetting("Stopwatch-Laps", saveLaps); }
public void LoadLapAndSplitData() { string[] laps; string[] splits; laps = IS.GetSettingStringValue("Stopwatch-Laps").Split(','); splits = IS.GetSettingStringValue("Stopwatch-Splits").Split(','); for (int i = laps.Count() - 1; i >= 0; i--) { if (laps[i] != string.Empty) { StopwatchTimes stopwatchTimes = new StopwatchTimes(); stopwatchTimes.ItemCount = laps.Count() - i - 1; stopwatchTimes.LapTime = laps[i]; stopwatchTimes.SplitTime = splits[i]; StopwatchTimesCollection.Insert(0, stopwatchTimes); _lastSplitTime = TimeSpan.Parse(stopwatchTimes.SplitTime); } } }
private void StopWatch_Reset_Click(object sender, EventArgs e) { App.gStopWatch.Stop(); MessageBoxResult result = MessageBox.Show(AppResources.ResetMessage, AppResources.ResetText, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { App.gStopWatch.Reset(); _adjustment = new TimeSpan(); _lastSplitTime = new TimeSpan(); StopwatchTimesCollection.Clear(); IS.RemoveSetting("Stopwatch-Laps"); IS.RemoveSetting("Stopwatch-Splits"); Mode = AppResources.StartText; Start.Background = new SolidColorBrush(Colors.Green); } else { App.gStopWatch.Stop(); Mode = AppResources.ResumeText; Start.Background = new SolidColorBrush(Colors.Green); } }