private async void PART_Stepper_ContinueNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { // 发送申请 DonationMaterialListViewModel selected = (DonationMaterialListViewModel)MaterialSelectListBox.SelectedItem; if (selected == null) { MainWindow.SetSnackBarContentAndPopup("请选择要捐赠的物资"); args.Cancel = true; return; } else if (QuantityInputBox.Value == null || QuantityInputBox.Value <= 0) { MainWindow.SetSnackBarContentAndPopup("不合法的数目"); args.Cancel = true; return; } NewDonationResponse response = await NetworkHelper.GetAsync(new NewDonationRequest() { MaterialId = selected.OriginItem.Id, Quantity = (int)QuantityInputBox.Value, Address = UserInfo.HomeAddress }).Progress(ParentWindow.PART_ProgressBar); DonationViewModel = new DonationListViewModel(response.Item); DonationDetailViewModel = new DonationDetailViewModel(await NetworkHelper.GetAsync(new GetDonationDetailRequest() { UserId = UserInfo.Id, DonationId = DonationViewModel.OriginalItem.ID }).Progress(ParentWindow.PART_ProgressBar)); RefreshApplicationCardView(); }
private void MaterialSelectListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { DonationMaterialListViewModel selected = (DonationMaterialListViewModel)MaterialSelectListBox.SelectedItem; if (selected != null) { MaterialNameTextBlock.Text = selected.Name; MaterialDetailTextBlock.Text = selected.Description; } else { MaterialNameTextBlock.Text = "请选择想要捐赠的物资"; } }