private void HandleCatalogRemove(Catalog o) { IEnumerable <CatalogViewModel> cvmList = Data.Where(c => c.Data.CatalogFilePath == o.CatalogFilePath); //exist ? update view model if (cvmList.Count() == 1) { CatalogViewModel cvm = Data.Single(c => c.Data.CatalogFilePath == o.CatalogFilePath); Data.Remove(cvm); } }
void RefreshCover(string param) { try { if (this.ActiveDocument is LibraryViewModel) { CatalogViewModel current = (this.ActiveDocument as LibraryViewModel).Catalogs.CurrentItem as CatalogViewModel; Messenger.Default.Send <string>(ViewModelMessages.CatalogRefreshCover, current.Data.CatalogFilePath); } } catch (Exception err) { LogHelper.Manage("MainViewModel:RefreshCover", err); } }
void LibShare() { try { if (this.ActiveDocument is LibraryViewModel) { CatalogViewModel current = (this.ActiveDocument as LibraryViewModel).Catalogs.CurrentItem as CatalogViewModel; current.IsShared = !current.IsShared; } } catch (Exception err) { LogHelper.Manage("MainViewModel:LibShare", err); } }
private void HandleCatalogChange(Catalog o) { IEnumerable <CatalogViewModel> cvmList = Data.Where(c => c.Data.CatalogFilePath == o.CatalogFilePath); //exist ? then add, update is done in catalog view model if (cvmList.Count() == 1) { CatalogViewModel cvm = Data.Single(c => c.Data.CatalogFilePath == o.CatalogFilePath); if (File.Exists(o.CatalogFilePath)) { cvm.Data = o; } } else { HandleCatalogAdd(o); } }