Esempio n. 1
0
        //private void timer1_Tick(object sender, EventArgs e)
        //{
        //    if (Comm_Method.AiFileList.Count > 0)
        //    {
        //        this.timer1.Stop();
        //        this.thSavePdf = new Thread(new ThreadStart(SavePdf_Illustrator));
        //        thSavePdf.Start();
        //    }

        //}
        private void SavePdf_Illustrator()
        {
            while (true)
            {
                if (IsClose)
                {
                    break;
                }
                try
                {
                    while (Comm_Method.AiFileList.Count == 0 && !this.IsClose)
                    {
                        Thread.Sleep(5000);
                    }

                    // this.timer1.Stop();

                    //判断Adobe Illustrator CS6 (64 Bit)是否运行
                    string aiexe = @"C:\Program Files\Adobe\AdobeIllustratorCS6_x64\Support Files\Contents\Windows\Illustrator.exe";
                    if (File.Exists(aiexe))
                    {
                        if (Process.GetProcessesByName("Illustrator").Length == 0)
                        {
                            Comm_Method.ExecuteCom(string.Format("\"{0}\"", aiexe), false);
                        }
                        Illustrator.ApplicationClass app = new Illustrator.ApplicationClass();

                        while (Comm_Method.AiFileList.Count > 0)
                        {
                            while (app.Documents.Count > 0 && !this.IsClose)
                            {
                                Thread.Sleep(5000);
                            }
                            string aiFile = Comm_Method.AiFileList[0];
                            app.DoJavaScript(Resources.AutoSavePdf.Replace
                                                 ("*文件名*", aiFile.Replace('\\', '/')));
                            Comm_Method.AiFileList.RemoveAt(0);
                            if (File.Exists(@"\\128.1.30.144\HotFolders\RefineToPDF\"
                                            + Path.GetFileNameWithoutExtension(aiFile) + ".pdf"))
                            {
                                string okDir = Path.GetDirectoryName(aiFile) + "\\ok\\";
                                if (!Directory.Exists(okDir))
                                {
                                    Directory.CreateDirectory(okDir);
                                }
                                FileSystem.MoveFile(aiFile, okDir + Path.GetFileName(aiFile)
                                                    , UIOption.AllDialogs, UICancelOption.DoNothing);
                            }
                        }
                    }
                }
                catch
                { }
                finally
                {
                    Thread.Sleep(5000);
                }
            }
        }
Esempio n. 2
0
 private void Stop_JPrinterJTP(string ip)
 {
     if (MessageBox.Show("确定要停止进程'JPrinterJTP'吗?"
                         + "\n\n以下进程将受影响:"
                         + "\n1.打印到设备"
                         + "\n2.打印到高分辨率文件"
                         + "\n3.打印到低分辨率文件", "确认?"
                         , MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
     {
         MessageBox.Show(Comm_Method.ExecuteCom("taskkill /S " + ip + " /U Administrator /P creo /IM JPrinterJTP.exe", true));
     }
 }