Esempio n. 1
0
        public static string AcquireFMS(XMLParameter acq)
        {
            string             rt_fmsID = string.Empty;
            AcquisitionService acqs     = new AcquisitionService();

            XMLResult rslAcqRVG = acqs.startAcquisition(acq);

            System.Threading.Thread.Sleep(3000);
            Utility.AcqFMS(40, 300);

            int       DORVGcount = 0;
            XMLResult getAcqRVG  = new XMLResult();

            do
            {
                System.Threading.Thread.Sleep(3000);
                System.Diagnostics.Debug.Print("get acquire in do");
                DORVGcount++;
                getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult);
                if (!getAcqRVG.IsErrorOccured)
                {
                    ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML

                    string   fmsID    = parser.getStringWithPathAndType("trophy/object_info", "fms", "value");
                    string[] fmsIDs   = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      fmsCount = fmsIDs.Length;

                    string   imageID    = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                    string[] imageIDs   = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      imageCount = imageIDs.Length;

                    string   psID    = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                    string[] psIDs   = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      psCount = psIDs.Length;

                    if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount)
                    {
                        rt_fmsID = fmsIDs[0];
                    }
                    else
                    {
                        rt_fmsID = "";
                    }
                    break;
                }
                if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499)
                {
                    continue;
                }
                if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499)
                {
                    rt_fmsID = string.Empty;
                }
                System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount);
                if (DORVGcount > 60)
                {
                    rt_fmsID = string.Empty;
                    break;
                }
            } while (true);

            return(rt_fmsID);
        }