private static void SaveDefaultProperty(ExportThroughPathway dlg) { Param.SetDefaultValue(Param.PrintVia, dlg.Format); Param.SetDefaultValue(Param.LayoutSelected, dlg.Style); // Processing Options tab if (string.IsNullOrEmpty(dlg.InputType) || dlg.InputType == "Dictionary") { Param.SetDefaultValue(Param.ConfigureDictionary, dlg.ExportMain.ToString()); Param.SetDefaultValue(Param.ReversalIndex, dlg.ExportReversal.ToString()); Param.SetDefaultValue(Param.GrammarSketch, dlg.ExportGrammar.ToString()); } Param.SetDefaultValue(Param.Media, _media); if (Common.CustomSaveInFolder(dlg.OutputFolder)) Param.SetValue(Param.PublicationLocation, dlg.OutputFolder); Param.Write(); }
/// <summary> /// Save the properties from the Export Through Pathway dialog to the appropriate StyleSettings xml file /// </summary> /// <param name="dlg"></param> private static bool SaveProperty(ExportThroughPathway dlg) { bool success = true; Param.SetValue(Param.PrintVia, dlg.Format); Param.SetValue(Param.LayoutSelected, dlg.Style); // Publication Information tab Param.UpdateTitleMetadataValue(Param.Title, dlg.Title, isFromConfigurationTool); Param.UpdateMetadataValue(Param.Description, dlg.Description); Param.UpdateMetadataValue(Param.Creator, dlg.Creator); Param.UpdateMetadataValue(Param.Publisher, dlg.Publisher); Param.UpdateMetadataValue(Param.CopyrightHolder, Common.UpdateCopyrightYear(dlg.CopyrightHolder)); // also persist the other DC elements Param.UpdateMetadataValue(Param.Type, dlg.Type); Param.UpdateMetadataValue(Param.Source, dlg.Source); Param.UpdateMetadataValue(Param.Format, GetFormatMimeType(dlg.Format)); Param.UpdateMetadataValue(Param.Contributor, dlg.Contributor); Param.UpdateMetadataValue(Param.Relation, dlg.Relation); Param.UpdateMetadataValue(Param.Coverage, dlg.Coverage); Param.UpdateMetadataValue(Param.Subject, dlg.Subject); dlg.Date = DateTime.Today.ToString("yyyy-MM-dd"); // Date gets today's date Param.UpdateMetadataValue(Param.Date, dlg.Date); Param.UpdateMetadataValue(Param.Language, dlg.Language); Param.UpdateMetadataValue(Param.Identifier, dlg.Identifier); Param.UpdateMetadataValue(Param.CoverPage, dlg.CoverPage.ToString()); Param.UpdateMetadataValue(Param.CoverPageFilename, dlg.CoverPageImagePath); Param.UpdateMetadataValue(Param.CoverPageTitle, dlg.CoverPageTitle.ToString()); Param.UpdateMetadataValue(Param.TitlePage, dlg.TitlePage.ToString()); if ((dlg.CoverPageTitle || dlg.TitlePage) && (dlg.Title.Trim().Length < 1)) { // User wants a title page or a cover page with a title, but they haven't told us the title. // Make them enter one now. var message = LocalizationManager.GetString("ExportThroughPathway.SaveProperty.Message1", "Please enter a title for this publication.", ""); Utils.MsgBox(message, dlg.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); dlg.IsExpanded = true; dlg.ResizeDialog(); dlg.tabControl1.SelectedTab = dlg.tabPage1; dlg.txtBookTitle.Focus(); return false; } Param.UpdateMetadataValue(Param.CopyrightPage, dlg.CopyrightPage.ToString()); Param.UpdateMetadataValue(Param.CopyrightPageFilename, dlg.CopyrightPagePath); Param.UpdateMetadataValue(Param.TableOfContents, dlg.TableOfContents.ToString()); // Processing Options tab if (string.IsNullOrEmpty(dlg.InputType) || dlg.InputType == "Dictionary") { success = (dlg.ExportReversal || dlg.ExportMain || dlg.ExportGrammar); if (!success) { // Dictionary with nothing to export. Make them export something. var message = LocalizationManager.GetString("ExportThroughPathway.SaveProperty.Message2", "Please select at least one item to include in the export.", ""); Utils.MsgBox(message, dlg.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); dlg.IsExpanded = true; dlg.ResizeDialog(); dlg.tabControl1.SelectedTab = dlg.tabPage3; dlg.chkConfiguredDictionary.Focus(); } Param.SetValue(Param.ConfigureDictionary, dlg.ExportMain.ToString()); Param.SetValue(Param.ReversalIndex, dlg.ExportReversal.ToString()); Param.SetValue(Param.GrammarSketch, dlg.ExportGrammar.ToString()); } Param.SetValue(Param.Media, _media); Param.SetValue(Param.PublicationLocation, dlg.OutputFolder); Param.Write(); return success; }
private void btnFlexTest2_Click(object sender, EventArgs e) { ExportThroughPathway dlg = new ExportThroughPathway(); dlg.InputType = "Dictionary"; dlg.ShowDialog(); string target = dlg.Format; //"OpenOffice"; var tpe = new PsExport {Destination = target, DataType = dlg.InputType}; tpe.Export(txtInputPath.Text); }
private static void Main(string[] args) { InputFormat inFormat = InputFormat.XHTML; var projectInfo = new PublicationInformation { ProjectInputType = "Dictionary", DefaultXhtmlFileWithPath = null, DefaultCssFileWithPath = null, IsOpenOutput = false, ProjectName = "main", }; var backendPath = Common.ProgInstall; var exportType = "OpenOffice/LibreOffice"; bool bOutputSpecified = false; var files = new List<string>(); bool bShowDialog = false; try { int i = 0; if (args.Length == 0) { Usage(); Environment.Exit(0); } while (i < args.Length) { i = ProcessExportType(args, i, projectInfo, files, ref inFormat, ref bShowDialog, ref exportType, ref bOutputSpecified); } SettingProcessExportFile(projectInfo, files); Common.ProgBase = Common.GetPSApplicationPath(); // load settings from the settings file Param.LoadSettings(); Param.Value[Param.InputType] = projectInfo.ProjectInputType; Param.LoadSettings(); if (bOutputSpecified) { // the user has specified an output -- update the settings so we export to that output Param.SetValue(Param.PrintVia, exportType); Param.Write(); } // if the caller wants to display the Export Through Pathway dialog, do it now. if (bShowDialog) { var dlg = new ExportThroughPathway(); dlg.InputType = projectInfo.ProjectInputType; dlg.DatabaseName = projectInfo.ProjectName; if (dlg.ShowDialog() == DialogResult.Yes) { exportType = dlg.Format; } else { // cancel export and exit out of PathwayB Environment.Exit(0); } } // run headless from the command line Common.Testing = true; ProcessInputFormat(inFormat, files, projectInfo); if (projectInfo.DefaultXhtmlFileWithPath == null) { Usage(); throw new ArgumentException("Missing required option: (DefaultXhtmlFileWithPath)."); } if (projectInfo.DefaultCssFileWithPath == null) { Usage(); throw new ArgumentException("Missing required option: (DefaultCssFileWithPath)."); } if (!File.Exists(projectInfo.DefaultXhtmlFileWithPath)) throw new ArgumentException(string.Format("Missing {0}", projectInfo.DefaultXhtmlFileWithPath)); if (!File.Exists(projectInfo.DefaultCssFileWithPath)) throw new ArgumentException(string.Format("Missing {0}", projectInfo.DefaultCssFileWithPath)); projectInfo.DictionaryPath = Path.GetDirectoryName(projectInfo.DefaultXhtmlFileWithPath); if (projectInfo.ProjectInputType.ToLower() == "dictionary") { Param.SetValue(Param.ReversalIndex, projectInfo.IsReversalExist ? "True" : "False"); Param.SetValue(Param.InputType, projectInfo.ProjectInputType); Param.Write(); } var tpe = new PsExport { Destination = Param.PrintVia, DataType = projectInfo.ProjectInputType }; tpe.ProgressBar = null; tpe.Export(projectInfo.DefaultXhtmlFileWithPath); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } catch (Exception err) { Console.WriteLine("PathwayB encountered an error while processing: " + err.Message); if (err.StackTrace != null) { Console.WriteLine(err.StackTrace); } Environment.Exit(-1); } Environment.Exit(0); }
public void tsDefault_ClickBL() { try { string formText = LocalizationManager.GetString("ExportThroughPathway.Dialog", "Set Defaults", ""); // EDB (2 May 2011): TD-2344 / replace with Export Through Pathway dlg var dlg = new ExportThroughPathway(formText); dlg.InputType = inputTypeBL; dlg.DatabaseName = "{Project_Name}"; dlg.Media = MediaType; dlg.ShowDialog(); } catch { } }