示例#1
0
        public bool writeCard(int comPort, string sID1)
        {
            string sType = "";
            string sID2  = "";
            string sName = CitacKartica.NAME_FIELD;

            AdminForm af          = Form1.Instance.AdminForm;
            bool      measureTime = af != null;

            Stopwatch watch = null;

            if (measureTime)
            {
                watch = Stopwatch.StartNew();
            }

            ulong retval;

            if (Options.Instance.JedinstvenProgram)
            {
                lock (readAndWriteLock)
                {
                    retval = WriteDataCard(comPort, sType, sID1, sID2, sName) & 0xFFFFFFFF;
                }
            }
            else
            {
                retval = WriteDataCard(comPort, sType, sID1, sID2, sName) & 0xFFFFFFFF;
            }

            if (measureTime)
            {
                watch.Stop();
                af.newPisanjeKartice(retval, watch.ElapsedMilliseconds);
            }

            return(retval == 1);
        }