public FormExportSelectionAsFormat(enumExportFormat f) { this.InitializeComponent(); var client = Globals.ThisAddIn.Client; if (!client.Document.HasActiveDocument) { MessageBox.Show("There is no drawing open to export"); } string ext = null; this.ExportFormat = f; switch (this.ExportFormat) { case (enumExportFormat.ExportSVGXHTML): { ext = ".xhtml"; this.labelFormatChoice.Text = "SVG + XHTML"; break; } case (enumExportFormat.ExportXAML): { ext = ".xaml"; this.labelFormatChoice.Text = "XAML"; break; } default: { throw new VA.AutomationException("Unsupported format"); } } var application = client.Application.Get(); var doc = application.ActiveDocument; var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); var page = application.ActivePage; var name = doc.Name + "_" + page.Name + ext; var fullname = System.IO.Path.Combine(path, name); this.filenamePicker1.Filename = fullname; this.labelDocumentName.Text = doc.Name; this.labelPageName.Text = page.NameU; }
public FormExportSelectionAsFormat( enumExportFormat f) { this.InitializeComponent(); var client = Globals.ThisAddIn.Client; if (!client.Document.HasActiveDocument) { MessageBox.Show("There is no drawing open to export"); } string ext = null; this.ExportFormat = f; switch (this.ExportFormat) { case (enumExportFormat.ExportSVGXHTML) : { ext = ".xhtml"; this.labelFormatChoice.Text = "SVG + XHTML"; break; } case (enumExportFormat.ExportXAML) : { ext = ".xaml"; this.labelFormatChoice.Text = "XAML"; break; } default : { throw new VA.AutomationException("Unsupported format"); } } var application = client.Application.Get(); var doc = application.ActiveDocument; var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); var page = application.ActivePage; var name = doc.Name + "_" + page.Name + ext; var fullname = System.IO.Path.Combine(path, name); this.filenamePicker1.Filename = fullname; this.labelDocumentName.Text = doc.Name; this.labelPageName.Text = page.NameU; }