public void checkin(PowerPoint.Presentation presentationDocument) { try { if (MessageBox.Show(resources.GetString("sure_check_in"), resources.GetString("checkin"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { String localFileName = presentationDocument.FullName; presentationDocument.Save(); // save document presentationDocument.Close(); // close document docXML.refresh(); // Refresh document list if (docXML.isOpenKMDocument(localFileName)) { OKMDocument oKMDocument = docXML.getOpenKMDocument(localFileName); docXML.remove(oKMDocument); DocumentLogic.checkin(oKMDocument, configXML.getHost(), configXML.getUser(), configXML.getPassword()); if (File.Exists(localFileName)) { File.Delete(localFileName); } } } } catch (Exception e) { String errorMsg = "OpenKMPowerPointAddIn - (checkinButton_Click)\n" + e.Message + "\n\n" + e.StackTrace; MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void checkin(Word._Document activeDocument) { try { if (MessageBox.Show(resources.GetString("sure_check_in"), resources.GetString("checkin"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { object saveChanges = Word.WdSaveOptions.wdSaveChanges; object missing = Type.Missing; String localFileName = activeDocument.FullName; activeDocument.Close(ref saveChanges, ref missing, ref missing); // Always we save document docXML.refresh(); // Refresh document list if (docXML.isOpenKMDocument(localFileName)) { OKMDocument oKMDocument = docXML.getOpenKMDocument(localFileName); docXML.remove(oKMDocument); DocumentLogic.checkin(oKMDocument, configXML.getHost(), configXML.getUser(), configXML.getPassword()); if (File.Exists(localFileName)) { File.Delete(localFileName); } } } } catch (Exception e) { String errorMsg = "OpenKMWordAddIn - (checkinButton_Click)\n" + e.Message + "\n\n" + e.StackTrace; MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }