Example #1
0
        public bool CloseandOpenAPC(byte mode)
        {
            bool isOK = false;

            if (GlobalParameters.APCType == Convert.ToByte(apctype.none))
            {
                Log.SaveLogToTxt("no apc");
                return(true);
            }
            try
            {
                switch (mode)
                {
                case (byte)APCMODE.IBAISandIMODON:
                {
                    Log.SaveLogToTxt("Open apc");
                    isOK = dut.APCON(0x11);
                    // isOK = dut.APCON(0x00);
                    Log.SaveLogToTxt("Open apc" + isOK.ToString());
                    break;
                }

                case (byte)APCMODE.IBAISandIMODOFF:
                {
                    Log.SaveLogToTxt(" Close apc");
                    isOK = dut.APCOFF(0x11);
                    Log.SaveLogToTxt("Close apc" + isOK.ToString());
                }
                break;

                case (byte)APCMODE.IBIASONandIMODOFF:
                {
                    Log.SaveLogToTxt(" Close IModAPCand Open IBiasAPC");
                    isOK = dut.APCON(0x01);
                    Log.SaveLogToTxt("Close IModAPCand Open IBiasAPC" + isOK.ToString());
                    break;
                }

                case (byte)APCMODE.IBIASOFFandIMODON:
                {
                    Log.SaveLogToTxt(" Close IBiasAPCand Open IModAPC");
                    isOK = dut.APCON(0x10);
                    Log.SaveLogToTxt("Close IBiasAPCand Open IModAPC" + isOK.ToString());
                    break;
                }

                default:
                {
                    break;
                }
                }
                return(isOK);
            }
            catch (InnoExCeption ex)//from driver
            {
                //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace);
                exceptionList.Add(ex);
                return(false);
            }
            catch (Exception error)//from itself
            {
                //one way: deal this exception itself
                InnoExCeption ex = new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace);
                //Log.SaveLogToTxt(ex.ID + ": " + ex.Message + "\r\n" + ex.StackTrace);
                exceptionList.Add(ex);
                return(false);
                //the other way is: should throw exception, rather than the above three code. see below:
                //throw new InnoExCeption(ExceptionDictionary.Code._0xFFFFF, error.StackTrace);
            }
        }