Ejemplo n.º 1
0
        private void ExportExecute(object parameter)
        {
            try
            {
                // Save html files in temp folder as this is Preview html.
                // IDocumentService doc = ServiceLocator.Current.GetInstance<IDocumentService>();

                //Get save path from project file, it's redundancy now..
                string _previewPath = CommonFunction.GetPreViewTempPath();

                if (String.IsNullOrEmpty(_previewPath))
                {
                    IWebServer httpServer = ServiceLocator.Current.GetInstance <IWebServer>();
                    if (httpServer.StartWebService())
                    {
                        _previewPath = CommonFunction.GetPreViewTempPath();
                    }
                    else
                    {
                        return;//if webservice error,cancel preview
                    }
                }

                if (Directory.Exists(_previewPath) == false)
                {
                    Directory.CreateDirectory(_previewPath);

                    string imageOutPutPath = _previewPath + @"\images";
                    Directory.CreateDirectory(imageOutPutPath);
                }
                DiffGeneratorParameter para = new DiffGeneratorParameter();
                para.SavePath = _previewPath;
                //para.Docs = DocArray;

                if (DocArray[0].Document != null && DocArray[1].Document != null)
                {
                    List <IDocumentService> docs = DocArray.OrderByDescending(a => a.Document.TimeStamp).ToList <IDocumentService>();
                    para.Docs = docs;
                    _ListEventAggregator.GetEvent <GenerateMD5HTMLEvent>().Publish(para);
                }
            }
            catch (Exception ex)
            {
            }
        }