示例#1
0
        protected override void Execute()
        {
            var report = _reportsViewerController.GetSelectedReports().FirstOrDefault();

            if (report == null)
            {
                return;
            }

            var reportTemplates        = _reportsViewerController.GetCustomReportTemplates();
            var reports                = _reportsViewerController.GetReports();
            var groupNames             = reports.OrderByDescending(b => b.Group).Select(a => a.Group).Distinct().ToList();
            var taskTemplateIdProvider = new TaskTemplateIdProvider();

            var viewModel = new AppendReportViewModel(report.Clone() as Report, _imageService,
                                                      _reportsViewerController.GetSelectedProject(), groupNames, reportTemplates, taskTemplateIdProvider, true);
            var view = new AppendReportWindow(viewModel, null);

            viewModel.Window = view;

            var result = view.ShowDialog();

            if (result != null && (bool)result)
            {
                _reportsViewerController.UpdateReports(new List <Report> {
                    viewModel.Report
                });
            }
        }
示例#2
0
        private void AddNewReport(Report report)
        {
            var selectedProject = _reportsViewerController.GetSelectedProject();

            if (selectedProject == null)
            {
                return;
            }

            var reportTemplates = GetCustomReportTemplates();

            var reports                = _reportsViewerController.GetReports();
            var groupNames             = reports.OrderByDescending(b => b.Group).Select(a => a.Group).Distinct().ToList();
            var taskTemplateIdProvider = new TaskTemplateIdProvider();

            var viewModel = new AppendReportViewModel(report, _imageService, selectedProject, groupNames, reportTemplates, taskTemplateIdProvider);
            var view      = new AppendReportWindow(viewModel, null);

            viewModel.Window = view;

            var result = view.ShowDialog();

            if (result != null && (bool)result)
            {
                _reportsViewerController.AddReports(new List <Report> {
                    viewModel.Report
                });
            }
        }
        public AppendReportWindow(AppendReportViewModel model, Window parentWindow)
        {
            InitializeComponent();

            _model = model;

            if (parentWindow == null)
            {
                var windowInteropHelper = new WindowInteropHelper(this);
                windowInteropHelper.Owner = ApplicationInstance.GetActiveForm().Handle;
            }
            else
            {
                Owner = parentWindow;
            }

            SourceInitialized += MainWindow_SourceInitialized;

            Loaded += AppendReportWindow_Loaded;
        }