protected override void OnNavigatedTo(NavigationEventArgs e) { this.learningUnit = e.Parameter as LearningUnit; this.modules.Clear(); this.learningUnit.modules.ForEach(modules.Add); this.learningUnitName = learningUnit.name; }
public async Task <LearningUnit> getLearningUnitAsync(string learningUnitId) { HttpResponseMessage response = await this.http.GetAsync(url + $"/api/learningunit/{learningUnitId}"); if (response.IsSuccessStatusCode) { LearningUnit learningUnit = await response.Content.ReadAsAsync <LearningUnit>(); return(learningUnit); } return(null); }
public async Task <LearningUnit> updateUnit(LearningUnit unit) { HttpResponseMessage response = await this.http.PutAsJsonAsync(url + $"/api/learningunit/{unit.id}", unit); if (response.IsSuccessStatusCode) { LearningUnit learningUnit = await response.Content.ReadAsAsync <LearningUnit>(); this.getLearningUnitsAsync(); return(learningUnit); } return(null); }
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); } }
public async Task addLearningUnitAsync(LearningUnit learningUnit) { HttpResponseMessage response = await this.http.PostAsJsonAsync(url + "/api/learningunit", learningUnit); if (response.IsSuccessStatusCode) { LearningUnit unit = await response.Content.ReadAsAsync <LearningUnit>(); this._learningUnits.Add(unit); } else { ContentDialog dialog = new ContentDialog() { Title = response.StatusCode }; await dialog.ShowAsync(); } }
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { this.result = await PsApi.getInstance().updateUnit(this.result); }
public UnitDialog(LearningUnit unit) { this.InitializeComponent(); this.result = unit; }
private void handleChangeSelectedUnit(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) { this.selectedUnit = args.SelectedItem as LearningUnit; this.contentFrame.Navigate(typeof(LearningUnitView), this.selectedUnit); }