예제 #1
0
        internal void ShowPromptAndDrawBlock()
        {
            try
            {
                string folderPath = getTempFolderPath(
                    Context.GetContext().AKInfo.Path);
                AKProduct product = AKProduct.Load(
                    Path.Combine(folderPath, "temp.xml"));

                var project = ProjectManager.CreateOrOpenProject(
                    product.GetProjectPath());

                Product            mvProduct          = getProductFromProject(product, project);
                string             productCutx        = mvProduct.GetProductCutxFileName();
                SpecificationGroup specificationGroup =
                    project.SpecificationGroups.Find(it => it.Name == mvProduct.MatFile);
                var bookset = showPromptWindow(product, project, productCutx, specificationGroup);

                ProductAnalyst analyst = new ProductAnalyst();
                analyst.Analysis(mvProduct, bookset);

                BlockDrawer drawer = new BlockDrawer(product.Tab.VarX,
                                                     product.Tab.VarZ,
                                                     product.Tab.VarY,
                                                     Path.Combine(folderPath, product.Tab.DWG + ".dwg"));
                drawer.DrawAndSaveAs2(mvProduct, bookset);
            }
            catch (Exception error)
            {
                throw new Exception("Error occured during drawing....", error);
            }
        }
예제 #2
0
        private Product getProductFromProject(AKProduct akProduct, Project project)
        {
            if (project.HasProduct(akProduct.Tab.DMID))
            {
                Logger.GetLogger().Debug("Project has the product:" + akProduct.Tab.Name);
                var _product = project.Products
                               .Find(it => it.Handle.ToUpper() == akProduct.Tab.DMID.ToUpper());
                _product.Width  = akProduct.Tab.VarX;
                _product.Height = akProduct.Tab.VarZ;
                _product.Depth  = akProduct.Tab.VarY;

                //TODO:update the info in the project database

                return(_product);
            }
            else
            {
                Logger.GetLogger().Debug("Project do not have the product:" + akProduct.Tab.Name);
                Logger.GetLogger().Debug("Add product to project and copy template from library.");
                return(project.AddProduct(akProduct.Tab.Name,
                                          akProduct.Tab.DMID,
                                          akProduct.Tab.VarX,
                                          akProduct.Tab.VarZ,
                                          akProduct.Tab.VarY,
                                          Context.GetContext().MVDataContext.GetProduct(akProduct.Tab.Name)));
            }
        }
예제 #3
0
        private Product getProductFromProject(AKProduct akProduct, Project project)
        {
            if (project.HasProduct(akProduct.Tab.DMID))
            {
                Logger.GetLogger().Debug("Project has the product:" + akProduct.Tab.Name);
                var _product = project.Products
                                     .Find(it => it.Handle.ToUpper() == akProduct.Tab.DMID.ToUpper());
                _product.Width = akProduct.Tab.VarX;
                _product.Height = akProduct.Tab.VarZ;
                _product.Depth = akProduct.Tab.VarY;

                //TODO:update the info in the project database

                return _product;
            }
            else
            {
                Logger.GetLogger().Debug("Project do not have the product:" + akProduct.Tab.Name);
                Logger.GetLogger().Debug("Add product to project and copy template from library.");
                return project.AddProduct(akProduct.Tab.Name,
                                          akProduct.Tab.DMID,
                                          akProduct.Tab.VarX,
                                          akProduct.Tab.VarZ,
                                          akProduct.Tab.VarY,
                                          Context.GetContext().MVDataContext.GetProduct(akProduct.Tab.Name));
            }
        }
예제 #4
0
        internal static AKProduct Load(string tempXMLFilePath)
        {
            Logging.Logger.GetLogger().Debug("Getting cabinet information from temp.xml file...");
            Logging.Logger.GetLogger().Debug("File path:" + tempXMLFilePath);

            AKProduct product = new AKProduct();

            XElement xml = XElement.Load(tempXMLFilePath);

            product.UIVars = from n in xml.Elements("UIVar")
                             select new UIVar(
                (string)n.Attribute("Name"),
                (string)n.Attribute("Value")
                );


            product.Tab = new TabInfo();

            var tab = from t in xml.Elements("Tab")
                      select t;
            var tabNode = tab.SingleOrDefault();

            product.Tab.Name        = tabNode.Attribute("Name").Value;
            product.Tab.DWG         = tabNode.Attribute("DWG").Value;
            product.Tab.ID          = tabNode.Attribute("ID").Value;
            product.Tab.DMID        = tabNode.Attribute("DMID").Value;
            product.Tab.Photo       = tabNode.Attribute("Photo").Value;
            product.Tab.Description = tabNode.Attribute("Descprition") == null ?
                                      string.Empty : tabNode.Attribute("Description").Value;
            product.Tab.CatalogPath = tabNode.Attribute("Path").Value;

            var vars = from t in xml.Elements("Tab").Elements("Var")
                       select t;

            foreach (var v in vars)
            {
                switch (v.Attribute("Name").Value.ToString())
                {
                case "X":
                    product.Tab.VarX = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                    break;

                case "Y":
                    product.Tab.VarY = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                    break;

                case "Z":
                    product.Tab.VarZ = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                    break;
                }
            }

            return(product);
        }
예제 #5
0
        internal static AKProduct Load(string tempXMLFilePath)
        {
            Logging.Logger.GetLogger().Debug("Getting cabinet information from temp.xml file...");
            Logging.Logger.GetLogger().Debug("File path:" + tempXMLFilePath);

            AKProduct product = new AKProduct();

            XElement xml = XElement.Load(tempXMLFilePath);
            product.UIVars = from n in xml.Elements("UIVar")
                             select new UIVar(
                                    (string)n.Attribute("Name"),
                                    (string)n.Attribute("Value")
                                 );


            product.Tab = new TabInfo();

            var tab = from t in xml.Elements("Tab")
                      select t;
            var tabNode = tab.SingleOrDefault();
            product.Tab.Name = tabNode.Attribute("Name").Value;
            product.Tab.DWG = tabNode.Attribute("DWG").Value;
            product.Tab.ID = tabNode.Attribute("ID").Value;
            product.Tab.DMID = tabNode.Attribute("DMID").Value;
            product.Tab.Photo = tabNode.Attribute("Photo").Value;
            product.Tab.Description = tabNode.Attribute("Descprition") == null ?
                                        string.Empty : tabNode.Attribute("Description").Value;
            product.Tab.CatalogPath = tabNode.Attribute("Path").Value;

            var vars = from t in xml.Elements("Tab").Elements("Var")
                       select t;

            foreach (var v in vars)
            {
                switch (v.Attribute("Name").Value.ToString())
                {
                    case "X":
                        product.Tab.VarX = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                        break;
                    case "Y":
                        product.Tab.VarY = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                        break;
                    case "Z":
                        product.Tab.VarZ = UnitConverter.GetValueFromString(v.Attribute("Value").Value);
                        break;
                }
            }

            return product;
        }
예제 #6
0
        private static IWorkbookSet showPromptWindow(AKProduct product, Project project, string productCutx, SpecificationGroup specificationGroup)
        {
            string globalGvfx = Path.Combine(project.JobPath, specificationGroup.GlobalFileName);
            string cutPartsCtpx = Path.Combine(project.JobPath, specificationGroup.CutPartsFileName);
            string edgeEdgx = Path.Combine(project.JobPath, specificationGroup.EdgeBandFileName);
            string hardwareHwrx = Path.Combine(project.JobPath, specificationGroup.HardwareFileName);
            string doorstyleDsvx = Path.Combine(project.JobPath, specificationGroup.DoorWizardFileName);

            PromptsViewModel viewmodel = new PromptsViewModel(productCutx, globalGvfx, cutPartsCtpx, edgeEdgx, hardwareHwrx, doorstyleDsvx,
                    product.Tab.Name, product.Tab.Photo, product.Tab.VarX, product.Tab.VarZ, product.Tab.VarY);

            PromptWindow prompt = new PromptWindow();
            prompt.ViewModel = viewmodel;
            prompt.ShowDialog();

            return viewmodel.BookSet;
        }
예제 #7
0
        private static IWorkbookSet showPromptWindow(AKProduct product, Project project, string productCutx, SpecificationGroup specificationGroup)
        {
            string globalGvfx    = Path.Combine(project.JobPath, specificationGroup.GlobalFileName);
            string cutPartsCtpx  = Path.Combine(project.JobPath, specificationGroup.CutPartsFileName);
            string edgeEdgx      = Path.Combine(project.JobPath, specificationGroup.EdgeBandFileName);
            string hardwareHwrx  = Path.Combine(project.JobPath, specificationGroup.HardwareFileName);
            string doorstyleDsvx = Path.Combine(project.JobPath, specificationGroup.DoorWizardFileName);

            PromptsViewModel viewmodel = new PromptsViewModel(productCutx, globalGvfx, cutPartsCtpx, edgeEdgx, hardwareHwrx, doorstyleDsvx,
                                                              product.Tab.Name, product.Tab.Photo, product.Tab.VarX, product.Tab.VarZ, product.Tab.VarY);

            PromptWindow prompt = new PromptWindow();

            prompt.ViewModel = viewmodel;
            prompt.ShowDialog();

            return(viewmodel.BookSet);
        }