public ApplicationPage(MainWindow parent, ApplicationListViewModel userApplicationViewModel)
        {
            InitializeComponent();

            ParentWindow         = parent;
            ApplicationViewModel = userApplicationViewModel;
        }
        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)
            {
                // 确认
            }
        }
Exemple #3
0
        private void UserApplicationList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ApplicationListViewModel userApplicationViewModel = (ApplicationListViewModel)UserApplicationList.SelectedItem;

            if (userApplicationViewModel != null)
            {
                ParentWindow.NavigateToApplicationPageAndDisplay(userApplicationViewModel);
            }
        }
        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 void UserApplicationList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ApplicationListViewModel userApplicationViewModel = (ApplicationListViewModel)UserApplicationList.SelectedItem;

            if (userApplicationViewModel != null && userApplicationViewModel.OriginalItem.State != ApplicationState.Aborted)
            {
                // Aborted不允许进入详情页
                ParentWindow.NavigateToApplicationPageAndDisplay(userApplicationViewModel);
            }
        }