private void presetListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var list = (ListBox)sender; if (list.SelectedItems.Count > 0) { // loop current selection selectedPreset = (Preset)list.SelectedItem; viewModel.Loop(selectedPreset); viewModel.NewPresetName = selectedPreset.Name; var startPos = new SongPosition(selectedPreset.Begin); var stopPos = new SongPosition(selectedPreset.End); viewModel.StartMin = startPos.mins.ToString(); viewModel.StartSec = startPos.secs.ToString(); viewModel.StartMSec = startPos.ms.ToString(); viewModel.StopMin = stopPos.mins.ToString(); viewModel.StopSec = stopPos.secs.ToString(); viewModel.StopMSec = stopPos.ms.ToString(); } else { // loop entire song selectedPreset = null; } }
private void SetTimerText(double seconds) { var pos = new SongPosition(seconds); viewModel.PositionTxt = pos.mins.ToString().PadLeft(2, '0') + ":" + pos.secs.ToString().PadLeft(2, '0') + ":" + pos.ms.ToString("F0").PadLeft(2, '0'); }