/// <summary> /// Export according to selected format /// </summary> /// <param name="selectedFormat">Selected format</param> /// <returns></returns> public DialogResult Import(string selectedFormat) { DialogResult dialogResult = DialogResult.OK; ImportFormat format = GetSelectedImportFormat(selectedFormat); try { switch (format) { case ImportFormat.DWG: ImportDWGData importDWGData = new ImportDWGData(m_commandData, format); using (ImportDWGForm importForm = new ImportDWGForm(importDWGData)) { dialogResult = importForm.ShowDialog(); } break; case ImportFormat.IMAGE: ImportImageData importIMAGEData = new ImportImageData(m_commandData, format); dialogResult = Import(importIMAGEData); break; case ImportFormat.GBXML: ImportGBXMLData importGBXMLData = new ImportGBXMLData(m_commandData, format); dialogResult = Import(importGBXMLData); break; case ImportFormat.Inventor: ImportInventorData importInventorData = new ImportInventorData(m_commandData, format); dialogResult = Import(importInventorData); break; default: break; } } catch (Exception) { String errorMessage = "Failed to import " + format + " format"; TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok); } return(dialogResult); }
/// <summary> /// Constructor /// </summary> /// <param name="importData"></param> public ImportDWGForm(ImportDWGData importData) { InitializeComponent(); m_importData = importData; InitializeControls(); }
/// <summary> /// Export according to selected format /// </summary> /// <param name="selectedFormat">Selected format</param> /// <returns></returns> public DialogResult Import(string selectedFormat) { DialogResult dialogResult = DialogResult.OK; ImportFormat format = GetSelectedImportFormat(selectedFormat); try { switch (format) { case ImportFormat.DWG: ImportDWGData importDWGData = new ImportDWGData(m_commandData, format); using (ImportDWGForm importForm = new ImportDWGForm(importDWGData)) { dialogResult = importForm.ShowDialog(); } break; case ImportFormat.IMAGE: ImportImageData importIMAGEData = new ImportImageData(m_commandData, format); dialogResult = Import(importIMAGEData); break; case ImportFormat.GBXML: ImportGBXMLData importGBXMLData = new ImportGBXMLData(m_commandData, format); dialogResult = Import(importGBXMLData); break; case ImportFormat.Inventor: ImportInventorData importInventorData = new ImportInventorData(m_commandData, format); dialogResult = Import(importInventorData); break; default: break; } } catch (Exception) { String errorMessage = "Failed to import " + format + " format"; TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok); } return dialogResult; }