示例#1
0
        public UInt16 GetID(byte type = 0)
        {
            UInt16 ret = 0;

            try
            {
                if (type == 0)
                {
                    IDProperty item = _LstIngIDProperty.First(c => c.IsUsed == false);
                    ret         = item.ID;
                    item.IsUsed = true;
                }
                else
                {
                    IDProperty item = LstRcpIDProperty.First(c => c.IsUsed == false);
                    ret         = item.ID;
                    item.IsUsed = true;
                }
            }
            catch (Exception)
            {
            }
            return(ret);
        }
示例#2
0
 private void InitIDGenrator()
 {
     try
     {
         _IDControl = (IDGenrator)Function.XmlSerializer.LoadFromXml("EVO.ID.xml", typeof(IDGenrator));
     }
     catch (Exception)
     {
         for (int i = 1; i < 101; i++)
         {
             IDProperty tmp = new IDProperty();
             tmp.ID = (UInt16)i;
             tmp.IsUsed = false;
             _IDControl.LstIngIDProperty.Add(tmp);
             tmp = new IDProperty();
             tmp.ID = (UInt16)i;
             tmp.IsUsed = false;
             _IDControl.LstRcpIDProperty.Add(tmp);
         }
         Function.XmlSerializer.SaveToXml("EVO.ID.xml", _IDControl, typeof(IDGenrator), null);
     }
 }