void OnEditBpm(object sender, PointerPressedEventArgs args) { var project = DocManager.Inst.Project; var dialog = new TypeInDialog(); dialog.Title = "BPM"; dialog.SetText(project.bpm.ToString()); dialog.onFinish = s => { if (double.TryParse(s, out double bpm)) { viewModel.PlaybackViewModel.SetBpm(bpm); } }; dialog.ShowDialog(this); }
void OnEditTimeSignature(object sender, PointerPressedEventArgs args) { var project = DocManager.Inst.Project; var dialog = new TypeInDialog(); dialog.Title = "Time Signature"; dialog.SetText($"{project.beatPerBar}/{project.beatUnit}"); dialog.onFinish = s => { var parts = s.Split('/'); int beatPerBar = parts.Length > 0 && int.TryParse(parts[0], out beatPerBar) ? beatPerBar : project.beatPerBar; int beatUnit = parts.Length > 1 && int.TryParse(parts[1], out beatUnit) ? beatUnit : project.beatUnit; viewModel.PlaybackViewModel.SetTimeSignature(beatPerBar, beatUnit); }; dialog.ShowDialog(this); }