Esempio n. 1
0
 /// <summary>
 /// Добавляет подсеть в список подсетей репозитория.
 /// </summary>
 /// <param name="subnet">Подсеть</param>
 public void AddSubnet(Subnet subnet)
 {
     if (subnet != null)
     {
         Application.Current.Dispatcher.Invoke(() =>
         {
             Subnets.Add(subnet);
             if (subnet.Printers.Count > 0)
             {
                 SimpleSummary summary = SubnetSummaries.FirstOrDefault(x => x.Parameter == subnet.Address);
                 if (summary is null)
                 {
                     var newSummary = new SimpleSummary(subnet.Address, subnet.Printers.Count);
                     SubnetSummaries.Add(newSummary);
                 }
                 else
                 {
                     summary.Count += subnet.Printers.Count;
                 }
                 SubnetSummaries.Sort();
             }
         });
         SubnetCount = Subnets.Where(x => x.Printers.Count > 0).Count();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Очищает репозиторий.
 /// </summary>
 public void Clear()
 {
     Subnets.ToList().ForEach(x => x.Printers.Clear());
     Subnets.Clear();
     Printers.Clear();
     ModelSummaries.Clear();
     SubnetSummaries.Clear();
     DeviceCount = 0;
     SubnetCount = 0;
 }