public void SetCameras(CameraListViewModel c) { foreach (IPictureViewModel picture in List) { if (picture.Camera != null) { ((PictureViewModel)picture).Camera = c.GetCamera(picture.Camera.ID); } } }
public MainWindowViewModel(UpdateSources UpdatePicture, UpdateSources UpdatePhotographer, UpdateSources UpdateCamera) { _UpdatePicture = UpdatePicture; _UpdatePhotographer = UpdatePhotographer; _UpdateCamera = UpdateCamera; bl.Error += (message) => System.Windows.MessageBox.Show(message); bl.Sync(); _List = new PictureListViewModel(bl.GetPictures(null, null, null, null)); _CameraList = new CameraListViewModel(bl.GetCameras()); ((PictureListViewModel)List).SetCameras(CameraList); _PhotographerList = new PhotographerListViewModel(bl.GetPhotographers()); ((PictureListViewModel)List).SetPhotographers(PhotographerList); _Search = new SearchViewModel(); //nicht neu instanzieren _Search.SearchActivated += (s, e) => List = new PictureListViewModel(bl.GetPictures(e.Searchtext, null, null, null)); }