public WorkoutManagerViewModel()
        {
            Add = new Command(async() =>
            {
                await navigation_.PushAsync(new WorkoutCreation());
                await RefreshList();
            });

            Edit = new Command <object>(async w =>
            {
                var workout = Workouts.First(e => e == w);
                await workout.Edit(database_);
                Workouts.Remove(workout);
                Workouts.Add(await database_.GetWorkout(workout.Id, workout.WorkoutType));
            });

            Delete = new Command <object>(async w =>
            {
                var workout = (IWorkout)w;
                if (await AskQuestion("Delete " + workout.Title + " is permament"))
                {
                    Workouts.Remove(workout);
                    await workout.RemoveFrom(database_);
                }
            });
        }
示例#2
0
 private async Task LaunchWorkout(string title)
 {
     var workout = Workouts.First(w => w.Title.Equals(title));
     await workout.ExecuteWorkout(database_);
 }