private void GeneratePdfs()
        {
            string filePath = _savingFilePathSelector.GetFilePath(
                string.Format("Výčetky {0}", SelectedYear),
                obj => {
                SaveFileDialog d = (SaveFileDialog)obj;
                d.Filter         = "PDF dokument (*.pdf)|*.pdf";
            }
                );

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            ProgressBarWindowViewModel pb = new ProgressBarWindowViewModel();

            Task.Run(async() => {
                List <Listing> list = new List <Listing>();
                for (int month = 0; month < 12; month++)
                {
                    list.Add(new Listing(SelectedYear, month + 1));
                }

                Document doc = _multipleListingReportFactory.Create(list, new DefaultListingPdfReportSetting());
                _listingReportGenerator.Save(filePath, doc);

                pb.Success = true;
                await Task.Delay(pb.ResultIconDelay);

                pb.TryClose();
            });

            _windowManager.ShowDialog(pb);
        }
Exemple #2
0
        private void GeneratePdf()
        {
            string filePath = _savingFilePathSelector.GetFilePath(string.Format("{0} {1} - {2}", Date.Months[12 - Listing.Month], Listing.Year, Listing.Name), PrepareDialog);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            ProgressBarWindowViewModel pb = new ProgressBarWindowViewModel()
            {
                Text = "Vytváří se Váš PDF dokument..."
            };

            Task.Run(async() => {
                Document doc = _listingPdfDocumentFactory.Create(Listing, _pdfSetting);
                _listingReportGenerator.Save(filePath, doc);

                pb.Success = true;
                await Task.Delay(pb.ResultIconDelay);

                pb.TryClose();
            });

            _windowManager.ShowDialog(pb);
        }
Exemple #3
0
        private void GeneratePdfs()
        {
            string filePath = _filePathDialogService.GetFilePath <SaveFileDialog>(
                string.Format("Výčetky {0}", SelectedYear),
                d => { d.Filter = "PDF dokument (*.pdf)|*.pdf"; }
                );

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            IOverlayToken ot = Overlay.DisplayOverlay(PrepareViewModel <ProgressViewModel>(), true);

            Task.Run(() => {
                List <Listing> list = new List <Listing>();
                for (int month = 0; month < 12; month++)
                {
                    list.Add(_listingFactory.Create(SelectedYear, month + 1));
                }

                Document doc = _multipleListingReportFactory.Create(list, new DefaultListingPdfReportSetting());

                _listingReportGenerator.Save(filePath, doc);

                ot.HideOverlay();
                EventAggregator.PublishOnUIThread(new ListingPdfSuccessfullyGeneratedMessage());
            });
        }
Exemple #4
0
        private void GeneratePdf()
        {
            if (CanGenerate == false)
            {
                return;
            }

            string fileName = SelectedMonth == 0 ?
                              string.Format("Rok {0}", SelectedYear) :
                              string.Format("{1} {0}", SelectedYear, Date.Months[12 - SelectedMonth]);

            string filePath = _filePathDialogService.GetFilePath <SaveFileDialog>(
                fileName,
                d => { d.Filter = "PDF dokument (*.pdf)|*.pdf"; }
                );

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            IOverlayToken ot = Overlay.DisplayOverlay(PrepareViewModel <ProgressViewModel>(), true);

            Task.Factory.StartNew(() => {
                IEnumerable <Listing> listings = from ListingCheckBoxWrapper lw in _listingsList where lw.IsChecked == true select lw.Listing;
                Document doc = _multipleListingReportFactory.Create(listings, PdfGenerationSettingsViewModel.PdfSetting);

                _listingReportGenerator.Save(filePath, doc);

                ot.HideOverlay();
                EventAggregator.PublishOnUIThread(new ListingPdfSuccessfullyGeneratedMessage());
            });
        }
Exemple #5
0
        private void GeneratePdf()
        {
            string filePath = _filePathDialogService.GetFilePath <SaveFileDialog>(
                string.Format("{0} {1} - {2}", Date.Months[12 - Listing.Month], Listing.Year, Listing.Name),
                d => { d.Filter = "PDF dokument (*.pdf)|*.pdf"; }
                );

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            IOverlayToken ot = Overlay.DisplayOverlay(PrepareViewModel <ProgressViewModel>(), true);

            Task.Run(() => {
                Document doc = _listingsReportFactory.Create(new Listing[] { Listing }, _pdfGenerationSettingsViewModel.PdfSetting);
                _listingReportGenerator.Save(filePath, doc);

                ot.HideOverlay();
                EventAggregator.PublishOnUIThread(new ListingPdfSuccessfullyGeneratedMessage());
            });
        }