Beispiel #1
0
 /// <summary>
 /// Sorts <see cref="Retailers"/> by retailer cooler percentage in ascending or descending order (depending on UI interaction)
 /// </summary>
 public void SortRetailersByCooler()
 {
     if (sortedByCooler == false)
     {
         ObservableCollection <Retailer> tmp = new ObservableCollection <Retailer>(Retailers.OrderBy(Retailer => Retailer.CoolerPercentage));
         Retailers.Clear();
         foreach (Retailer i in tmp)
         {
             Retailers.Add(i);
         }
         sortedByCooler = true;
     }
     else
     {
         ObservableCollection <Retailer> tmp = new ObservableCollection <Retailer>(Retailers.OrderByDescending(Retailer => Retailer.CoolerPercentage));
         Retailers.Clear();
         foreach (Retailer i in tmp)
         {
             Retailers.Add(i);
         }
         sortedByCooler = false;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Sorts <see cref="Retailers"/> by retailer online abbreviation in ascending or descending order (depending on UI interaction)
 /// </summary>
 public void SortRetailersByAbbreviation()
 {
     if (sortedByAbbrev == false)
     {
         ObservableCollection <Retailer> tmp = new ObservableCollection <Retailer>(Retailers.OrderBy(Retailer => Retailer.OnlineAbbrev));
         Retailers.Clear();
         foreach (Retailer i in tmp)
         {
             Retailers.Add(i);
         }
         sortedByAbbrev = true;
     }
     else
     {
         ObservableCollection <Retailer> tmp = new ObservableCollection <Retailer>(Retailers.OrderByDescending(Retailer => Retailer.OnlineAbbrev));
         Retailers.Clear();
         foreach (Retailer i in tmp)
         {
             Retailers.Add(i);
         }
         sortedByAbbrev = false;
     }
 }