예제 #1
0
 private void Configuration_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(Configuration.BrowserList))
     {
         var added = Configuration.BrowserList.Where(b => Choices.All(c => c.Model.Name != b.Name)).ToList();
         if (added.Count > 0)
         {
             foreach (var vm in added.Select(m => new BrowserViewModel(m, this)))
             {
                 Choices.Add(vm);
             }
         }
         var removed = Choices.Where(c => Configuration.BrowserList.All(b => b.Name != c.Model.Name)).ToList();
         if (removed.Count > 0)
         {
             foreach (var m in removed)
             {
                 Choices.Remove(m);
             }
         }
     }
 }