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);
        }
Beispiel #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);
        }
Beispiel #3
0
        private void CreateBackup()
        {
            DateTime now      = DateTime.Now;
            string   filePath = _savingFilePathSelector.GetFilePath(
                string.Format("Záloha dat - {0}-{1}-{2}", now.Day, now.Month, now.Year),
                obj => {
                SaveFileDialog d = (SaveFileDialog)obj;
                d.Filter         = "Evidoo data (*.evdo)|*.evdo";
            }
                );

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

            ProgressBarWindowViewModel pb = new ProgressBarWindowViewModel();

            Task.Run(async() => {
                _settingFacade.BackupData(filePath);

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

                pb.TryClose();
            });

            _windowManager.ShowDialog(pb);
        }
Beispiel #4
0
        private async void ImportBackup()
        {
            ProgressBarWindowViewModel pb = new ProgressBarWindowViewModel();
            Task <ResultObject>        t  = Task <ResultObject> .Run(async() => {
                ResultObject r = _settingFacade.ImportBackup(BackupFilePath);

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

                pb.TryClose();

                return(r);
            });

            _windowManager.ShowDialog(pb);

            ResultObject ro = await t;

            _defaultSetting = _settingFacade.GetDefaultSettings();
            Reset();

            BackupFilePath          = null;
            ImportDataResultMessage = ro.GetLastMessage();
        }