Example #1
0
 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);
     }
 }
Example #2
0
 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);
     }
 }
Example #3
0
        // Refreshing icons
        private void refreshIcons(String localFileName)
        {
            try
            {
                DocumentXML docXML = openkmAddIn.getDocXML();
                docXML.refresh(); // Refresh document list
                if (localFileName != null && ExcelApp.Workbooks.Count > 0)
                {
                    if (docXML.isOpenKMDocument(localFileName))
                    {
                        commandBarOption.setAdd(false);
                        commandBarOption.setEdit(false);
                        commandBarOption.setCheckin(true);
                        commandBarOption.setCancelCheckin(true);
                    }
                    else
                    {
                        commandBarOption.setAdd(true);
                        commandBarOption.setEdit(true);
                        commandBarOption.setCheckin(false);
                        commandBarOption.setCancelCheckin(false);
                    }
                }
                else
                {
                    commandBarOption.setAdd(false);
                    commandBarOption.setEdit(true);
                    commandBarOption.setCheckin(false);
                    commandBarOption.setCancelCheckin(false);
                }

                // Evaluate add icon
                if (commandBarOption.isAdd())
                {
                    addButton.Image         = ImageToolBar.IMG_TOOLBAR_ADD;
                    addRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_ADD;
                    addRibbonButton.Enabled = true;
                }
                else
                {
                    addButton.Image         = ImageToolBar.IMG_TOOLBAR_ADD_DISABLED;
                    addRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_ADD_DISABLED;
                    addRibbonButton.Enabled = false;
                }

                // Evaluate edit icon
                if (commandBarOption.isEdit())
                {
                    editButton.Image         = ImageToolBar.IMG_TOOLBAR_EDIT;
                    editRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_EDIT;
                    editRibbonButton.Enabled = true;
                }
                else
                {
                    editButton.Image         = ImageToolBar.IMG_TOOLBAR_EDIT_DISABLED;
                    editRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_EDIT_DISABLED;
                    editRibbonButton.Enabled = false;
                }

                // Evaluate checkin icon
                if (commandBarOption.isCheckin())
                {
                    checkinButton.Image         = ImageToolBar.IMG_TOOLBAR_CHECKIN;
                    checkinRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_CHECKIN;
                    checkinRibbonButton.Enabled = true;
                }
                else
                {
                    checkinButton.Image         = ImageToolBar.IMG_TOOLBAR_CHECKIN_DISABLED;
                    checkinRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_CHECKIN_DISABLED;
                    checkinRibbonButton.Enabled = false;
                }

                // Evaluate cancelcheckin icon
                if (commandBarOption.isCancelCheckin())
                {
                    cancelCheckoutButton.Image         = ImageToolBar.IMG_TOOLBAR_CANCELCHECKOUT;
                    cancelCheckoutRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_CANCELCHECKOUT;
                    cancelCheckoutRibbonButton.Enabled = true;
                }
                else
                {
                    cancelCheckoutButton.Image         = ImageToolBar.IMG_TOOLBAR_CANCELCHECKOUT_DISABLED;
                    cancelCheckoutRibbonButton.Image   = ImageToolBar.IMG_TOOLBAR_CANCELCHECKOUT_DISABLED;
                    cancelCheckoutRibbonButton.Enabled = false;
                }
            }
            catch (COMException)
            {
                // Not trowed
            }
            catch (Exception e)
            {
                throw e;
            }
        }