示例#1
0
 public void RemovePhone(int index, bool ModelsEnded = false)
 {
     Phones.RemoveAt(index);
     Save();
     if (ModelsEnded)
     {
         FileInfo fileInfo = new FileInfo(current_phone.Name);
         if (fileInfo.Exists)
         {
             fileInfo.Delete();
         }
     }
 }
示例#2
0
        public void Delete(int type, Guid serialNumber)
        {
            switch (type)
            {
            case 1:
                for (var i = 0; i < Computers.Count; i++)
                {
                    if (Computers[i].SerialNumber == serialNumber)
                    {
                        Computers.RemoveAt(i);
                        break;
                    }
                }

                break;

            case 2:
                for (var i = 0; i < Phones.Count; i++)
                {
                    if (Phones[i].SerialNumber == serialNumber)
                    {
                        Phones.RemoveAt(i);
                        break;
                    }
                }

                break;

            case 3:
                for (var i = 0; i < Vehicles.Count; i++)
                {
                    if (Vehicles[i].SerialNumber == serialNumber)
                    {
                        Vehicles.RemoveAt(i);
                        break;
                    }
                }

                break;
            }
        }