예제 #1
0
        private string[] readEPC()
        {
            String data = "No tags found";

            String[]      epcs     = null;
            List <String> listEpcs = new List <string>();
            int           intentos = 0;

            try
            {
                while (intentos != 20)
                {
                    data = reader.ReadEPC(false, ",");
                    if (data != "No tags found")
                    {
                        epcs = data.Split(new char[] { ',' });
                        foreach (String str in epcs)
                        {
                            if (!listEpcs.Contains(str))
                            {
                                listEpcs.Add(str);
                            }
                        }
                    }
                    intentos++;
                }
                return(listEpcs.ToArray());
            }
            catch (Exception exc)
            {
                return(null);
            }
        }
예제 #2
0
        private String leerEPC()
        {
            String data = "No tags found";

            String[] epcs     = null;
            int      intentos = 0;

            try
            {
                while (data.Equals("No tags found") && intentos != 20)
                {
                    data = reader.ReadEPC(false, ",");
                    epcs = data.Split(',');
                    intentos++;
                    data = epcs[0];
                }

                return(data);
            }
            catch (Exception exc)
            {
                if (!exc.Message.Equals("Se interrumpió el estado de espera del subproceso."))
                {
                    MessageBox.Show(this, "Error leyendo EPCS: \n" + exc.Message, "Error al leer Tags", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                return(null);
            }
        }