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));
            }
        }
        public void SetData(IWorkbook book, Project project, string productHandle)
        {
            this.book = book;
            this.project = project;
            this.productHandle = productHandle;

            LoadSubassemblies();

            LoadBookSubassemblies();
        }
        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;
        }
        public PromptsViewModel(string name,
                                string imagePath,
                                double width,
                                double height,
                                double depth,
                                Project project)
            : this()
        {
            this.Width = width;
            Logger.GetLogger().Debug(string.Format("Width:{0}", width));

            this.Height = height;
            Logger.GetLogger().Debug(string.Format("Height:{0}", height));

            this.Depth = depth;
            Logger.GetLogger().Debug(string.Format("Depth:{0}", depth));

            this.Name = name;
            Logger.GetLogger().Debug(string.Format("Name:{0}", name));

            this.ProductImagePath = imagePath + ".jpg";
            Logger.GetLogger().Debug(string.Format("ProductImagePath:{0}.jpg", imagePath));
        }
        /// <summary>
        /// 获取Project
        /// 如果是空目录,则创建目录,拷贝相应的数据
        /// 如果是已有内容的目录,则根据目录获取
        /// </summary>
        /// <param name="path">工作任务的路径</param>
        /// <returns></returns>
        public static Project GetProjectByPath(string path)
        {
            var project = new Project();
            project.JobPath = path;

            return project;
        }