Ejemplo n.º 1
0
        private void handleLoadedTemplates(TECTemplates templates)
        {
            if (ReplaceScope)
            {
                bid.Templates.Unionize(templates.Templates);
            }
            else
            {
                bid.Templates.Fill(templates.Templates);
            }

            if (ReplaceCatalogs)
            {
                bid.Catalogs.Unionize(templates.Catalogs);
            }
            else
            {
                bid.Catalogs.Fill(templates.Catalogs);
            }

            if (databaseManager == null && bid.Templates.Parameters.Count > 0)
            {
                bid.Parameters = new TECParameters(bid.Templates.Parameters.First());
            }

            ModelLinkingHelper.LinkBidToCatalogs(bid);

            estimate = new TECEstimator(bid, watcher);

            EditorVM = new EstimateEditorVM(bid, watcher, estimate);

            CurrentVM   = EditorVM;
            ViewEnabled = true;
        }
Ejemplo n.º 2
0
        protected override void handleLoaded(TECBid loadedBid)
        {
            if (loadedBid != null)
            {
                bid        = loadedBid;
                watcher    = new ChangeWatcher(bid);
                doStack    = new DoStacker(watcher);
                deltaStack = new DeltaStacker(watcher, bid);

                if (databaseManager == null && currentTemplatesPath != "")
                {
                    DatabaseManager <TECTemplates> templatesDatabaseManager = new DatabaseManager <TECTemplates>(currentTemplatesPath);
                    templatesDatabaseManager.LoadComplete += handleLoadedTemplates;
                    ViewEnabled = false;
                    templatesDatabaseManager.AsyncLoad();
                }
                else
                {
                    estimate    = new TECEstimator(bid, watcher);
                    EditorVM    = new EstimateEditorVM(bid, watcher, estimate);
                    CurrentVM   = EditorVM;
                    ViewEnabled = true;
                }
            }
            else
            {
                this.splashVM.LoadingText = "";
                ViewEnabled = true;
            }
        }