private void handleClickDeleteModule(object sender, RoutedEventArgs e) { Module module = (Module)((Button)sender).DataContext; PsApi.getInstance().deleteModule(module.id, this.learningUnit.id); this.modules.Remove(module); }
public Home() { this.InitializeComponent(); this.learningUnits = PsApi.getInstance().learningUnits; this.fetchLearningUnits(); }
private async void handleClickSave(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if (this.mode == ModuleDialogMode.CREATE) // Create { this.result = await PsApi.getInstance().createModule(this.result, this.unitId); } else if (this.mode == ModuleDialogMode.EDIT) // Update { this.result = await PsApi.getInstance().updateModule(this.result, this.unitId); } }
private async void handleClickDeleteGrade(object sender, RoutedEventArgs e) { Grade grade = (Grade)((Button)sender).DataContext; Module module = modules.FirstOrDefault(m => m.grades.Select(g => grade.id).Contains(grade.id)); PsApi.getInstance().deleteGrade(grade.id, module.id); module.grades.Remove(grade); int index = this.modules.IndexOf(module); modules.RemoveAt(index); modules.Insert(index, module); }
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if (this.mode == GradeDialogMode.CREATE) // Create { this.result = await PsApi.getInstance().createGrade(this.result, this.moduleId); } else if (this.mode == GradeDialogMode.EDIT) // Update { this.result = await PsApi.getInstance().updateGrade(this.result, this.moduleId); } }
private async void handleClickAddGrade(object sender, RoutedEventArgs e) { Module module = (Module)((Button)sender).DataContext; var gradeDialog = new GradeDialog(new Grade(), module.id, GradeDialog.GradeDialogMode.CREATE); var buttonClicked = await gradeDialog.ShowAsync(); module.grades.Add(gradeDialog.result); if (buttonClicked == ContentDialogResult.Primary) { this.learningUnit = await PsApi.getInstance().getLearningUnitAsync(this.learningUnit.id); this.modules.Clear(); this.learningUnit.modules.ForEach(modules.Add); } }
private void handleClickValider(object sender, RoutedEventArgs e) { PsApi.getInstance().addLearningUnitAsync(new LearningUnit(this.name)); }
private void handleClickDeleteUnit(object sender, RoutedEventArgs e) { PsApi.getInstance().deleteUnit(this.learningUnit.id); this.Frame.Navigate(typeof(Empty)); }
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { this.result = await PsApi.getInstance().updateUnit(this.result); }
public void fetchLearningUnits() { PsApi.getInstance().getLearningUnitsAsync(); Debug.WriteLine(this.learningUnits.Count); }
public MainPage() { this.InitializeComponent(); this.service = PsApi.getInstance(); }