Пример #1
0
        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);
            }
        }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
        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);
            }
        }