Mark Heath avatar Mark Heath committed 5ffd861

refactored CombinedTrackLoader

Comments (0)

Files changed (4)

MusicRater/Model/Criteria.cs

             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; }
     }
 }

MusicRater/Persistence/CombinedTrackLoader.cs

     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)

MusicRater/ViewModels/ConfigWindowViewModel.cs

         {
             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);
         }

MusicRater/ViewModels/MainPageViewModel.cs

             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();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.