Beispiel #1
0
 /// <summary>
 /// Load in the list Units the list of units from the Web service
 /// Or from the local file if the WS is not available
 /// </summary>
 /// <param name="forced">force the loading from the web service even if Units contains something</param>
 /// <returns>the static list Units of Unit</returns>
 public async static Task <List <Unit> > LoadUnits(bool forced = false)
 {
     try
     {
         if (forced)
         {
             Units = await WSConsumer.GetUnits();
         }
         else
         {
             Units = Units ?? await WSConsumer.GetUnits();
         }
     }
     catch (Exception e)
     {
         DependencyService.Get <IMessage>().longtime("ERR: " + e.Message);
         Units = Units ?? await LoadList("unit.json", Units);
     }
     return(Units);
 }