예제 #1
0
        /// <summary>
        /// Function to translate all sub documents in the Master Document
        /// </summary>
        /// <param name="outputfilepath">Path of the output File</param>
        /// <param name="subList">List of All documents</param>
        /// <param name="HTable">Document Properties</param>
        /// <param name="tempInputFile">Duplicate for the Input File</param>
        public void OoxToDaisySub(String outputfilepath, ArrayList subList, Hashtable HTable, String tempInputFile, string control, Hashtable listMathMl, string output_Pipeline, ArrayList notTranslatedDoc)
        {
            flag = 0;
            validationErrorMsg = "";
            using (Progress progress = new Progress(this.converter, this.resourceManager, outputfilepath, subList, HTable, tempInputFile, control, listMathMl, output_Pipeline))
            {
                DialogResult dr = progress.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    validationErrorMsg = progress.ValidationError;
                    String messageDocsSkip = DocumentSkipped(notTranslatedDoc);
                    if (!string.IsNullOrEmpty(validationErrorMsg))
                    {
                        validationErrorMsg = validationErrorMsg + messageDocsSkip;
                        OnMasterSubValidationError(validationErrorMsg);
                    }
                    else if (progress.HasLostElements)
                    {
                        OnLostElements(string.Empty, outputfilepath + "\\1.xml", progress.LostElements);

                        if (AddInHelper.PipelineIsInstalled() &&
                            AddInHelper.buttonIsSingleWordToXMLConversion(control) &&
                            ScriptToExecute != null &&
                            IsContinueDTBookGenerationOnLostElements())
                        {
                            try
                            {
                                ExecuteScript(outputfilepath + "\\" + Path.GetFileNameWithoutExtension(tempInputFile) + ".xml");
                            }
                            catch (Exception e)
                            {
                                AddinLogger.Error(e);
                                OnUnknownError(e.Message);
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(messageDocsSkip))
                        {
                            OnSuccessMasterSubValidation(ResManager.GetString("SucessLabel") + messageDocsSkip);
                        }
                        else
                        {
                            if (AddInHelper.IsSingleDaisyTranslate(control) && ScriptToExecute == null)
                            {
                                OnSuccess();
                            }
                            else
                            {
                                ExecuteScript(outputfilepath + "\\" + Path.GetFileNameWithoutExtension(tempInputFile) + ".xml");
                            }
                        }
                    }
                }
                else if (dr == DialogResult.Cancel)
                {
                    DeleteDTBookFilesIfExists(outputfilepath);
                }
                else
                {
                    validationErrorMsg = progress.ValidationError;
                    if (!string.IsNullOrEmpty(validationErrorMsg))
                    {
                        OnMasterSubValidationError(validationErrorMsg);
                    }
                }
            }
            DeleteTemporaryImages();
        }