public void OnImportSharedFavButton(Office.IRibbonControl control) { logger.Log("Import button clicked."); if (!this.AskForImportConfirmation()) { logger.Log("User cancelled import."); return; } var filePath = DialogUtil.GetFilePathViaDialog(isSaveAction: false); if (filePath != null) { if (this.importExportService.ImportFromFile(filePath)) { //import is done. Maybe set theme as default? if (shapePersistence.GetPersistedTheme() == null) { //no theme to import MessageBox.Show("Successfully imported favorites."); } else { HandlePersistedThemeImport(); } } else { MessageBox.Show("An error occured while importing favorites.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void OnExportSharedFavButton(Office.IRibbonControl control) { logger.Log("Export button clicked."); var filePath = DialogUtil.GetFilePathViaDialog(isSaveAction: true); if (filePath != null) { if (this.importExportService.ExportToFile(filePath)) { MessageBox.Show("Successfully exported favorites."); } else { MessageBox.Show("An error occured while exporting favorites.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void OnAddPresentation(Office.IRibbonControl control) { logger.Log("Add Presentation button clicked."); var filePath = DialogUtil.GetFilePathViaDialog(isSaveAction: false, filter: DialogUtil.POWERPOINT_PRESENTATION_FILTER); if (filePath == null) { return; } if (!filePath.EndsWith(".pptx")) { MessageBox.Show("This file format is not supported.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ShapePersistence.INSTANCE.SavePresentation(filePath)) { MessageBox.Show("Presentation was successfully imported.", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("An error occured while importing the presentation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }