Пример #1
0
        static SaveFileDialog CreateSaveFileDialog(ExportOptionsControllerBase controller)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title         = PreviewLocalizer.GetString(PreviewStringId.SaveDlg_Title);
            dlg.ValidateNames = true;
            dlg.FileName      = PrintPreviewOptions.DefaultFileNameDefault;
            dlg.Filter        = controller.Filter;
            return(dlg);
        }
Пример #2
0
 protected override void Export(ExportOptionsViewModel exportOptionsModel)
 {
     if (string.IsNullOrEmpty(Path.GetExtension(exportOptionsModel.FileName)))
     {
         var extension = ExportOptionsControllerBase
                         .GetControllerByOptions(exportOptionsModel.ExportOptions)
                         .GetFileExtension(exportOptionsModel.ExportOptions);
         exportOptionsModel.FileName += extension;
     }
     base.Export(exportOptionsModel);
 }
Пример #3
0
        static string GetFileName(ExportOptionsControllerBase controller)
        {
            SaveFileDialog dlg = CreateSaveFileDialog(controller);

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.FileName))
            {
                return(FileHelper.SetValidExtension(dlg.FileName, controller.FileExtensions[0], controller.FileExtensions));
            }
            else
            {
                return(string.Empty);
            }
        }
Пример #4
0
        public static bool?Export(ExportFormat format, PrintingSystem printingSystem)
        {
            ExportOptionsBase           options    = GetExportOptions(format, printingSystem);
            ExportOptionsControllerBase controller = ExportOptionsControllerBase.GetControllerByOptions(options);

            LineBase[] lines = Array.ConvertAll(controller.GetExportLines(options, new LineFactory(),
                                                                          AvailableExportModes, new List <ExportOptionKind>()), line => (LineBase)line);

            if (lines.Length > 0)
            {
                LinesWindow linesWindow = new LinesWindow();
                linesWindow.WindowStyle = WindowStyle.ToolWindow;
                linesWindow.Owner       = Application.Current.MainWindow;
                linesWindow.Title       = Properties.Resources.ExportOptions;
                linesWindow.SetLines(lines);

                return(linesWindow.ShowDialog());
            }

            return(null);
        }
Пример #5
0
 protected static string GetFileName(ExportOptionsBase options)
 {
     return(GetFileName(ExportOptionsControllerBase.GetControllerByOptions(options)));
 }