1. Mark Heath
  2. MusicRater

Commits

Mark Heath  committed 5ffd861

refactored CombinedTrackLoader

  • Participants
  • Parent commits f620e63
  • Branches default

Comments (0)

Files changed (4)

File MusicRater/Model/Criteria.cs

View file
  • Ignore whitespace
             this.Weight = weight;
         }
 
-        public string Name { get; private set; }
-        public int Weight { get; private set; }
+        public string Name { get; set; }
+        public int Weight { get; set; }
     }
 }

File MusicRater/Persistence/CombinedTrackLoader.cs

View file
  • Ignore whitespace
     public class CombinedTrackLoader : ITrackLoader
     {
         private readonly ITrackLoader firstTimeLoader;
-        private readonly string fileName;
+        private readonly ITrackLoader subsequentLoader;
 
-        public CombinedTrackLoader(ITrackLoader firstTimeLoader, string fileName)
+        public CombinedTrackLoader(ITrackLoader firstTimeLoader, ITrackLoader subsequentLoader)
         {
             this.firstTimeLoader = firstTimeLoader;
-            this.fileName = fileName;
+            this.subsequentLoader = subsequentLoader;
+            subsequentLoader.Loaded += new EventHandler<LoadedEventArgs>(loader_Loaded);
         }
 
         public void BeginLoad()
-        {
-            IsolatedStoreTrackLoader loader = new IsolatedStoreTrackLoader(fileName);
-            loader.Loaded += new EventHandler<LoadedEventArgs>(loader_Loaded);
-            loader.BeginLoad();
+        {            
+            subsequentLoader.BeginLoad();
         }
 
         void loader_Loaded(object sender, LoadedEventArgs e)

File MusicRater/ViewModels/ConfigWindowViewModel.cs

View file
  • Ignore whitespace
         {
             for (int n = 0; n < this.original.Count; n++)
             {
-                //this.original[n].Name = this.edited[n].Name;
-                //this.original[n].Weight = this.edited[n].Weight;
+                this.original[n].Name = this.edited[n].Name;
+                this.original[n].Weight = this.edited[n].Weight;
             }
             this.updateDialogResult(true);
         }

File MusicRater/ViewModels/MainPageViewModel.cs

View file
  • Ignore whitespace
             this.AnonCommand = new AnonymiseCommand(this.Tracks);
 
             //"http://www.archive.org/download/KvrOsc28TyrellN6/KvrOsc28TyrellN6_files.xml"
-            KvrTrackLoader kvrLoader = new KvrTrackLoader("http://www.archive.org/download/KvrOsc29StringTheory/KvrOsc29StringTheory_files.xml");
-            ITrackLoader loader = new CombinedTrackLoader(kvrLoader, contestFileName);
+            var kvrLoader = new KvrTrackLoader("http://www.archive.org/download/KvrOsc29StringTheory/KvrOsc29StringTheory_files.xml");
+            var isoLoader = new IsolatedStoreTrackLoader(contestFileName);
+            ITrackLoader loader = new CombinedTrackLoader(kvrLoader, isoLoader);
             loader.Loaded += new EventHandler<LoadedEventArgs>(loader_Loaded);
             this.IsLoading = true;
             loader.BeginLoad();