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 async void PART_Stepper_ContinueNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { int idx = 0; for (; idx < PART_Stepper.Controller.Steps.Length; ++idx) { if (args.CurrentStep == PART_Stepper.Controller.Steps[idx]) { break; } } if (idx == 0) { // 从申请到等待审核 // TODO 这里有一个请求要发 await Task.Delay(100); ApplicationViewModel = new ApplicationListViewModel(); ApplicationDetailViewModel = new ApplicationDetailViewModel(); RefreshApplicationCardView(); } else if (idx == 3) { // 确认 } }
private async void PART_Stepper_CancelNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { await NetworkHelper.GetAsync(new CancelDonationRequest() { DonationId = DonationViewModel.OriginalItem.ID }) .Progress(ParentWindow.PART_ProgressBar); }
private async void PART_Stepper_ContinueNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { int idx = 0; for (; idx < PART_Stepper.Controller.Steps.Length; ++idx) { if (args.CurrentStep == PART_Stepper.Controller.Steps[idx]) { break; // 确定现在在哪个Step } } if (idx == 0) { // 发送申请 ApplicationMaterialListViewModel selected = (ApplicationMaterialListViewModel)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; } else if (QuantityInputBox.Value > selected.Constraint) { MainWindow.SetSnackBarContentAndPopup("超出数量限制"); args.Cancel = true; return; } NewApplicationResponse response = await NetworkHelper.GetAsync(new NewApplicationRequest() { MaterialId = selected.OriginItem.Id, Quantity = (int)QuantityInputBox.Value, Address = UserInfo.HomeAddress }).Progress(ParentWindow.PART_ProgressBar); ApplicationViewModel = new ApplicationListViewModel(response.Item); ApplicationDetailViewModel = new ApplicationDetailViewModel(await NetworkHelper.GetAsync(new GetApplicationDetailRequest() { ApplicationId = ApplicationViewModel.OriginalItem.ID }).Progress(ParentWindow.PART_ProgressBar)); RefreshApplicationCardView(); } else if (idx == 3) { // 确认 await NetworkHelper.GetAsync(new ConfirmApplicationDoneRequest() { ApplicationId = ApplicationViewModel.OriginalItem.ID }); } }
private async void PART_Stepper_CancelNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { // 发送撤销请求的包 await NetworkHelper.GetAsync(new CancelApplicationRequest() { ApplicationId = ApplicationViewModel.OriginalItem.ID }) .Progress(ParentWindow.PART_ProgressBar); MainWindow.SetSnackBarContentAndPopup("申请已取消"); ParentWindow.NavigateToMainPage(); }
private void PART_Stepper_CancelNavigation(object sender, MaterialDesignExtensions.Controls.StepperNavigationEventArgs args) { // TODO 这里需要发送撤销请求的包 }