コード例 #1
0
        public void UnInit()
        {
            var      processes = from p in System.Diagnostics.Process.GetProcessesByName("EXCEL") select p;
            DateTime DT        = DateTime.Now;

            foreach (var process in processes)
            {
                // All those background un-release process will be closed
                //Application.IgnoreRemoteRequests = False
                if (process.MainWindowTitle == "")
                {
                    process.Kill();
                }
            }

            if (SnpFile.FileOutputFileName != null)
            {
                string strHeaderPath;

                FileContains.Add("DATE_END=" + DT.ToString("yyyyMMdd") + "\r\n" + "TIME_END=" + DT.ToString("HHmmss"));
                strHeaderPath = Path.Combine(SnpFile.FileSourcePath, SnpFile.LotID + ".txt");
                _myUtility.Generate_SNP_Header(strHeaderPath, FileContains);
                _myUtility.SNP_SDI_Compression(SnpFile.FileOutputFileName, SnpFile.FileSourcePath, SnpFile.FileOutputPath);
            }

            string locSetFilePath = Convert.ToString(_dicCalInfo[DataFilePath.LocSettingPath]);
            bool   blnOcr         = (_myUtility.ReadTextFile(locSetFilePath, "OCR", "Enable").ToUpper() == "TRUE")? true: false;

            if (blnOcr)
            {
                switch (MessageBox.Show("Do you want to merge OCR automatically?", "Penang NPI", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                case DialogResult.Cancel:
                    break;

                case DialogResult.Yes:
                    LibOcr.OCR objOcr = new LibOcr.OCR();
                    objOcr.SetDateTime          = DT;
                    objOcr.SetVisionDefaultPath = _myUtility.ReadTextFile(locSetFilePath, "OCR", "VisionDefaultPath");
                    objOcr.SetResultDefault     = _myUtility.ReadTextFile(locSetFilePath, "OCR", "ResultDefaultPath");
                    objOcr.SetSite        = _myUtility.ReadTextFile(locSetFilePath, "OCR", "Site");
                    objOcr.SetImageServer = _myUtility.ReadTextFile(locSetFilePath, "OCR", "ImagePath");
                    objOcr.SetSdiServer   = _myUtility.ReadTextFile(locSetFilePath, "OCR", "SdiserverPath");
                    objOcr.SetResultFile  = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_CUR_RESULT_FILE, "");
                    objOcr.SetLotID       = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_LOT_ID, "");
                    objOcr.SetSublotId    = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_SUB_LOT_ID, "");
                    objOcr.Merge();

                    break;

                case DialogResult.No:
                    break;

                default:
                    break;
                }
            }
            InstrUnInit();
        }