예제 #1
0
        public void ConvertDefaults(List <DefaultAssignment> defaults)
        {
            ProductModel pm = ModelWorkspace.CreateFromFile(pmxFile).ProductModel;
            var          pmProductModelStructure = pm.ProductModelStructure;

            foreach (var defaultAssignment in defaults)
            {
                //var characteristic = _parseUtils.FindSelectionCriteriaCharacteristic( defaultAssignment.HierarchyElement );
                //var precondition = _parseUtils.GeneratePrecondition( characteristic, defaultAssignment.HierarchyElement );

                var model   = defaultAssignment.Model;
                var coutry  = defaultAssignment.Country;
                var variant = defaultAssignment.Variant;

                var defaultModel = new LogicModel();
                defaultModel.AddRule("", "", ExprBld.IfThen(
                                         (ExprBld.Variables["Model"] == model)
                                         .And(ExprBld.Variables["coutry"] == coutry)
                                         .And(ExprBld.Variables["variant"] == variant),
                                         ExprBld.Variables[defaultAssignment.Assignment.Characteristic]) ==
                                     defaultAssignment.Assignment.Value);
                var compiler          = new Core.Compile.Compilation.Compiler(defaultModel);
                var defaultSolveData  = compiler.CompileNddSolve();
                var scopedDefaultData = new ScopedDefaultData(new[] { "model", "country", "variant" }, defaultSolveData);

                var packagedModelSerializer = new PackagedModelSerializer();
                var packagedModel           = packagedModelSerializer.LoadAsync(cameronPackage).Result.CopyAndInclude(scopedDefaultData);
                packagedModelSerializer.SaveAsync(cameronPackage,
                                                  new[] { packagedModel }).Wait();
            }
        }
예제 #2
0
        private string WriteProductModelToFile(string marialName, ProductModel pm)
        {
            ModelWorkspace mws = new ModelWorkspace {
                ProductModel = pm
            };
            var newPmx        = marialName + "_N.pmx";
            var directoryInfo = Directory.CreateDirectory("ImportedModels");
            var pmxPath       = Path.Combine(directoryInfo.FullName, newPmx);

            mws.WriteToFile(pmxPath);
            return(newPmx);
        }
예제 #3
0
        private ProductModel LoadProductModel(string pmxFile)
        {
            var pm = ModelWorkspace.CreateFromFile(pmxFile).ProductModel;
            var variableProperties = pm.PropertyGroup.First(pg => pg.Name == "variables").Properties;
            var showProperty       = variableProperties.FirstOrDefault(p => p.Name.ToLower() == "show");

            if (showProperty == null)
            {
                variableProperties
                .Add(new Property("Show", null, ProductModel.BOOL_TYPENAME));
            }

            return(pm);
        }
 public ModelToolManager()
 {
     InitializeComponent();
     _ModelWorkspace = new ModelWorkspace();
     _ModelWorkspace.DataSources.CollectionChanged += DataSources_CollectionChanged;
     _model          = new TreeModel();
     treeView1.Model = _model;
     this._nodeStateIcon.DataPropertyName = "Image";
     this._nodeTextBox.DataPropertyName   = "Text";
     _contextMenu                    = new ContextMenuStrip();
     this.treeView1.BackColor        = Color.White; //ColorTranslator.FromHtml("#FF2D2D30");
     this.treeView1.BorderStyle      = BorderStyle.None;
     treeView1.NodeMouseDoubleClick += treeView1_NodeMouseDoubleClick;
     _MatMataList                    = new ObservableCollection <MatMeta>();
     _MatMataList.CollectionChanged += MatMataList_CollectionChanged;
     _VariableMataList               = new List <VariableMeta>();
     this.Load += ModelToolManager_Load;
 }