Пример #1
0
        public Dictionary<string,string> showmeinit(List<FixedPage> pages, List<string> pagename , string _projectname, Apartment agoutput, ref List<Dictionary<string,string>>paths , int index)
        {

            Dictionary<string, string> result = new Dictionary<string, string>();
            agtype = agoutput.AGtype;

            projectcount = 0;
            projectname = _projectname;
            pdfpath = "pdf\\";
            pdfoutname = "_Final";
            xpspath = "xps\\";

            
            tempPagesToShow.Clear();

            _pdfurls.Clear();
            _pagename.Clear();
            _pageurls.Clear();

            if (!Directory.Exists(root))
                Directory.CreateDirectory(root);


            ///Export\\mst_no+mst_sub_no+projectname+agtype 경로 생성

            pdfoutname = mst_no + mst_sub_no + "_" + projectname + "_" + agtype;
            bool exist = Directory.Exists(root + "\\" + pdfoutname + "*");

            if (exist)
            {
                DirectoryInfo[] directories = new DirectoryInfo(root).GetDirectories(pdfoutname + "*", SearchOption.TopDirectoryOnly);

                projectcount = directories.Length / 2;
            }
           


            //같은 경로/타입 폴더 이미 존재?!
            if (exist)
            {
                var msgBoxResult = MessageBox.Show("등록된 같은 타입의 보고서가 있습니다. 덮어 쓰시겠습니까?", "보고서 덮어쓰기", MessageBoxButton.OKCancel);
                if (msgBoxResult == MessageBoxResult.Cancel)
                {
                    saveas = true;
                }
                else
                {
                    saveas = false;
                    
                }
            }

                projectpath = root + "\\" + pdfoutname;


            //projectpath = 폴더 경로.




            this.Activate();


            pdfpath = projectpath + "_pdf\\";
            xpspath = projectpath + "_xps\\";

            if (!System.IO.Directory.Exists(pdfpath))
                System.IO.Directory.CreateDirectory(pdfpath);
            
            
            if (!System.IO.Directory.Exists(xpspath))
                System.IO.Directory.CreateDirectory(xpspath);


            string[] files = System.IO.Directory.GetFiles(xpspath);

            files.ToList().AddRange(System.IO.Directory.GetFiles(pdfpath));

            foreach (var file in files)
            {
                try
                {
                    System.IO.File.Delete(file);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }

            tempPagesToShow.Clear();
            foreach (var temppage in pages)
            {


                var temp = new FixedPage();
                
                temp = temppage;
                temp.BeginInit();
                temp.EndInit();

                tempPagesToShow.Add(temp);
                
            }
            
            this._pagename = pagename;

            for (int i = 0; i < pages.Count(); i++)
            {
                if (pages[i] != null)
                {
                    if (_pagename[i] == "sectionPage")
                    {
                        if (paths[index].ContainsKey("SECTION"))
                            paths[index].Remove("SECTION");
                        paths[index].Add("SECTION", SaveDocumentPagesToImages(CreateXps(i)));
                        Rhino.RhinoApp.WriteLine(paths[index]["SECTION"]);
                    }
                    else if (_pagename[i] == "typicalPlanPage1")
                    {
                        if (paths[index].ContainsKey("GROUND_PLAN"))
                            paths[index].Remove("GROUND_PLAN");
                        paths[index].Add("GROUND_PLAN", SaveDocumentPagesToImages(CreateXps(i)));
                        Rhino.RhinoApp.WriteLine(paths[index]["GROUND_PLAN"]);
                    }
                    else if (_pagename[i] == "typicalPlanPage3")
                    {
                        if (paths[index].ContainsKey("TYPICAL_PLAN"))
                            paths[index].Remove("TYPICAL_PLAN");
                        paths[index].Add("TYPICAL_PLAN", SaveDocumentPagesToImages(CreateXps(i)));
                        Rhino.RhinoApp.WriteLine(paths[index]["TYPICAL_PLAN"]);
                    }
                    
                    else
                        CreateXps(i);

                }
            }

            PrintPDF();

            return result;
        }