Commits

Matt Hamilton  committed e7ca1da

Update to MadProps.MvvmLight 2, minor changes around Title/Issues

  • Participants
  • Parent commits c48247c

Comments (0)

Files changed (7)

File Comicster.Core/Internal/TitleIssueCollection.cs

 
             base.InsertItem(index, item);
             item.Title = _title;
-
-            // need to do this to trigger the sorting in the UI. Necessary evil.
-            _title.NotifyIssuesChanged();
         }
 
         protected override void RemoveItem(int index)

File Comicster.Core/Issue.cs

 
                 RaisePropertyChanged("Number");
                 RaisePropertyChanged("TitleAndNumber");
+
+                if (_title != null)
+                {
+                    _title.NotifyIssuesChanged();
+                }
             }
         }
 
             get { return _title; }
             set
             {
+                if (_title != null && _title != value)
+                {
+                    _title.NotifyIssuesChanged();
+                }
+
                 _title = value;
                 RaisePropertyChanged("Title");
                 RaisePropertyChanged("TitleAndNumber");
 
                 if (_title != null)
                 {
+                    _title.NotifyIssuesChanged();
                     Collection = _title.Collection;
                 }
             }

File Comicster.Core/Title.cs

         public Title()
         {
             Issues = new TitleIssueCollection(this);
-
-            var observer = new Observer();
-            observer.Extend(new CollectionExpansionExtension());
-            observer.Extend(new ItemsChangedExtension())
-                .WhenAddedOrRemoved<Issue>(i => RaisePropertyChanged("IssueSummary"));
-            observer.Extend(new PropertyChangedExtension())
-                .WhenPropertyChanges<Issue>(e =>
-                    {
-                        if (e.PropertyName == "Number") RaisePropertyChanged("IssueSummary");
-                    });
-            observer.Add(Issues);
         }
 
         IFolder _parent;
             {
                 var issues = (from i in Issues
                                      let n = i.Number.All(Char.IsNumber) ? Int32.Parse(i.Number) : (int?)null 
-                                     orderby i.ReleaseDate
+                                     orderby i.Order
                                      select new { n, i.Number }).ToList();
 
                 if (!issues.Any()) return String.Empty;
         internal void NotifyIssuesChanged()
         {
             RaisePropertyChanged("Issues");
+            RaisePropertyChanged("IssueSummary");
         }
     }
 }

File Comicster/App.xaml.cs

 
             EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.LoadedEvent, new RoutedEventHandler(DatePicker_Loaded));
 
+            GalaSoft.MvvmLight.Threading.DispatcherHelper.Initialize();
+
             Bootstrapper.Run();
         }
 

File Comicster/Comicster.csproj

     <Reference Include="Autofac">
       <HintPath>..\Dependencies\Autofac\Autofac.dll</HintPath>
     </Reference>
+    <Reference Include="GalaSoft.MvvmLight.Extras.WPF4">
+      <HintPath>..\Dependencies\MvvmLight\GalaSoft.MvvmLight.Extras.WPF4.dll</HintPath>
+    </Reference>
     <Reference Include="GalaSoft.MvvmLight.WPF4">
       <HintPath>..\Dependencies\MvvmLight\GalaSoft.MvvmLight.WPF4.dll</HintPath>
     </Reference>

File Dependencies/MadProps/MadProps.MvvmLight.dll

Binary file modified.

File Dependencies/MvvmLight/GalaSoft.MvvmLight.Extras.WPF4.dll

Binary file added.