private async void OpenEditSessionExerciseDialogAsync(SessionExercise sessionExercise) { var sessionExerciseClone = sessionExercise.Clone(); var dialog = _dialogs.For <SessionExerciseDialogViewModel>(DialogsIdentifier); dialog.Data.DialogTitle = "Modified session exercise"; dialog.Data.SubmitButtonTitle = "Save"; dialog.Data.SessionExercise = SessionExerciseViewModel.FromModel(sessionExerciseClone); var dialogResult = await dialog.Show(); if (dialogResult != DialogResult.Ok) { return; } sessionExerciseClone = dialog.Data.SessionExercise.ToModel(); TrainingSession.Exercises.Replace(sessionExercise, sessionExerciseClone); }
private async void OpenAddSessionExerciseDialogAsync() { var exercise = new SessionExercise(); var dialog = _dialogs.For <SessionExerciseDialogViewModel>(DialogsIdentifier); dialog.Data.DialogTitle = "New session exercise"; dialog.Data.SubmitButtonTitle = "Create"; dialog.Data.SessionExercise = SessionExerciseViewModel.FromModel(exercise); var dialogResult = await dialog.Show(); if (dialogResult != DialogResult.Ok) { return; } exercise = dialog.Data.SessionExercise.ToModel(); TrainingSession.Exercises.Add(exercise); }