示例#1
0
 internal static void RefreshLibrary(Store.LibraryModel library)
 {
     Task.Run(async() =>
     {
         using (var service = new LibraryService(library))
         {
             if (!await service.RefreshLibrary())
             {
                 await Task.Delay(15 * 1000);
                 RefreshLibrary(library);
             }
         }
     });
 }
        internal static async Task UpdateLibrary(string libraryID)
        {
            await updateLibrarySemaphore.WaitAsync();

            try
            {
                Helpers.AppCenter.TrackEvent("Library.OnUpdating");
                var library = DependencyService.Get <Store.ILibraryStore>().GetLibrary(libraryID);
                using (var service = new LibraryService(library))
                {
                    await service.UpdateLibrary();
                }
                Helpers.AppCenter.TrackEvent("Library.OnUpdated");
            }
            catch (Exception ex) { Helpers.AppCenter.TrackEvent(ex); }
            finally { updateLibrarySemaphore.Release(); }
        }