Пример #1
0
 public CatalogViewModel(IDomainContext domainContext)
 {
     isInited      = false;
     HasError      = new BoolHolder();
     DomainContext = domainContext;
     HasChanges    = false;
     ShowPhotoOnMouseDoubleClick = false;
     RefreshView          = delegate { };
     RefreshDirectoryView = delegate { };
     RefreshBrandView     = delegate { };
     RefreshCatalogView   = delegate { };
     SetEnabled           = delegate { };
     HasResultGridErrors  = () => false;
     loadTimer            = new Timer();
     loadTimer.Interval   = 300; TimeSpan.FromMilliseconds(10);
     loadTimer.Elapsed   += LoadData_Tick;
     //loadQueue = new Queue<Action>();
     Model = new CatalogModel(domainContext);
     CatalogNavigateViewModel  = new CatalogNavigateViewModel(this, Model);
     CatalogDirectoryViewModel = new CatalogDirectoryViewModel(domainContext, Model?.SearchCriteria);
     CatalogBrandViewModel     = new CatalogBrandViewModel(domainContext, Model?.SearchCriteria);
     SubscribeEvents();
     SubscribeMessenger();
     InitCommands();
 }
Пример #2
0
        private object LoadDirectories(bool needToUpdate)
        {
            if (needToUpdate)
            {
                CatalogDirectoryViewModel.Refresh();
                DomainContext?.SetWaitMessage(AsyncOperationType.LoadBrands);
                CatalogBrandViewModel.Refresh();
                DomainContext?.SetWaitMessage(AsyncOperationType.LoadCatalog);
                LoadPricelist(true);
            }

            return(needToUpdate);
        }