Beispiel #1
0
 public static async Task Init(Settings settings)
 {
     if (string.IsNullOrEmpty(settings.RootPath))
     {
         return;
     }
     try
     {
         Helper.CurrentFolder = await StorageFolder.GetFolderFromPathAsync(settings.RootPath);
     }
     catch (FileNotFoundException)
     {
         App.LoadedListeners.Add(() =>
         {
             MainPage.Instance.ShowLocalizedNotification("RootNotFound");
             MainPage.Instance.NavigateToPage(typeof(SettingsPage));
         });
     }
     catch (Exception)
     {
     }
     MediaControl.AddMusicModifiedListener((before, after) =>
     {
         settings.FindAllMusicAndOperate(before, music => music.CopyFrom(after));
     });
     foreach (var item in await ApplicationData.Current.LocalFolder.GetItemsAsync())
     {
         if (item.Name.EndsWith(".TMP") || item.Name.EndsWith(".~tmp"))
         {
             await item.DeleteAsync();
         }
     }
 }