예제 #1
0
        private void exportButton_Click(object sender, RoutedEventArgs e)
        {
            DevExpress.Mvvm.IDialogService service = ExportDialogService;

            UICommand[] commands = new UICommand[] { new UICommand(null, "Cancel", null, false, true) };
            service.ShowDialog(commands, "Choose the format you want to export to", ViewModelSource.Create(() => new ExportViewModel(ReportsGrid)));
        }
예제 #2
0
        void OnViewChargeRequested(object sender, EventArgs e)
        {
            DevExpress.Mvvm.IDialogService service = ViewChargeDialogService;
            ChargeViewModel chargeViewModel        = (ChargeViewModel)sender;

            List <UICommand> commands = new List <UICommand>();

            commands.Add(new UICommand(null, "Save and Close", chargeViewModel.SaveChargeCommand, true, false));
            commands.Add(new UICommand(null, "Cancel", null, false, true));

            service.ShowDialog(commands, "A New Charge", chargeViewModel);
        }
예제 #3
0
        void ExpenseReportsView_ShowExpenseReport(object sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            DevExpress.Mvvm.IDialogService service = ViewReportDialogService;
            ExpenseReportViewModel         expenseReportViewModel = (ExpenseReportViewModel)sender;

            var editReportVM = new EditExpenseReportViewModel();

            editReportVM.ExpenseReport = expenseReportViewModel;

            AddChargesViewModel addChargesVM = new AddChargesViewModel();

            addChargesVM.LoadCharges();
            editReportVM.AddCharges = addChargesVM;

            ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel();

            associatedChargesVM.LoadCharges(expenseReportViewModel.ExpenseReportId);
            editReportVM.AssociatedCharges = associatedChargesVM;

            List <UICommand> commands = new List <UICommand>();

            if (DataContext is ApproveExpenseReportsViewModel)
            {
                ICommand approveCommand = new DelegateCommand <CancelEventArgs>(x => {
                    //if(ApproveDialogService.ShowDialog(MessageBoxButton.OKCancel, "Confirm expense report", null) == MessageBoxResult.OK) {
                    expenseReportViewModel.ApproveReportCommand.Execute(null);
                    //} else {
                    //    x.Cancel = true;
                    //}
                });
                commands.Add(new UICommand(null, "Approve", approveCommand, true, false));
            }
            if (editReportVM.CanSubmit)
            {
                commands.Add(new UICommand(null, "Submit", expenseReportViewModel.SubmitReportCommand, true, false));
            }

            UICommand cancelCommand = new UICommand(null, "Close", null, false, true);

            commands.Add(cancelCommand);


            if (service.ShowDialog(commands, expenseReportViewModel.Purpose + " report", editReportVM) != cancelCommand)
            {
                expenseReportViewModel.ExpenseReportsViewModel.OnExpenseReportApproved(editReportVM);
            }
        }