private void btn_gen_mesh_Click(object sender, EventArgs e) { Materials.Materials materials = new Materials.Materials(); double c = ReadDataFromWND.readDoubleFromTB(tb_c); double lambda = ReadDataFromWND.readDoubleFromTB(tb_lambda); double ro = ReadDataFromWND.readDoubleFromTB(tb_ro); double E = ReadDataFromWND.readDoubleFromTB(tb_e); double my = ReadDataFromWND.readDoubleFromTB(tb_my); Material material1 = new Material(E, my, ro, lambda, c); materials.Add(0, material1); c = ReadDataFromWND.readDoubleFromTB(tb_c2); lambda = ReadDataFromWND.readDoubleFromTB(tb_lambda2); ro = ReadDataFromWND.readDoubleFromTB(tb_ro2); E = ReadDataFromWND.readDoubleFromTB(tb_e2); my = ReadDataFromWND.readDoubleFromTB(tb_my2); Material material2 = new Material(E, my, ro, lambda, c); materials.Add(1, material2); mesh = new Mesh(materials); //mesh.MeshRectangle(shaft, readIntFromTB(tb_nodesOX), readIntFromTB(tb_nodesOY)); //mesh.MeshPlate(box, ReadDataFromWND.readIntFromTB(tb_nodesOX), ReadDataFromWND.readIntFromTB(tb_nodesOY), ReadDataFromWND.readIntFromTB(tb_nodesOZ)); mesh.MeshPlate(box, ReadDataFromWND.readIntFromTB(tb_nodesOX), ReadDataFromWND.readIntFromTB(tb_nodesOY), ReadDataFromWND.readIntFromTB(tb_nodesOZ), ReadDataFromWND.readDoubleFromTB(tb_sHeightOwner)); meshOK = true; Render(); }
protected override void Update(Material material) { var existing = Materials.FirstOrDefault(m => m.Id == material.Id); if (existing == null) return; material.Update(existing); }
void OnSelectedMaterial(object obj) { MaterialToUpdate = obj as Material; SetOriginal(); _existingMaterial = new Material(); MaterialToUpdate.Update(_existingMaterial); }
public void update_material() { // Setup new Bootstrap().Run(); var viewModel = new ViewModel(); var selectedMaterial = new Material() { Name = SOME_TEXT, BaseCost = SOME_DECIMAL_VALUE, Description = SOME_TEXT, Quantity = SOME_DECIMAL_VALUE, MarkupPrice = SOME_DECIMAL_VALUE, UnitType = SOME_TEXT }; Publish(Messages.REQUEST_SELECTED_MATERIAL_RESPONSE, selectedMaterial); // Test viewModel.Name = SOME_TEXT; viewModel.Save.Execute(null); // Verify var expected = viewModel.Name == SOME_TEXT && viewModel.IsUpdated; Assert.IsTrue(expected); }
private void ConvertMeshFrag(Zone zone, bool zoneConvert = false) { if (!byType.ContainsKey(54)) { return; } foreach (FragMesh frag in byType[54]) { var obj = zone.AddObject(frag._name); var vbuf = new VertexBuffer(frag); var off = 0; foreach (var polytex in frag.Polytex) { var count = polytex[0]; var index = polytex[1]; if (frag.Textures.Length > 1) { throw new IndexOutOfRangeException( "WldConverter.ConvertObjects -- frag.Textures.Length > 1"); } var texnames = ((FragRef[])frag.Textures[0].Value)[index].Resolve().OfType <string>().ToList(); var texFlags = ((TexRef)((FragRef[])frag.Textures[0].Value)[index].Value).SaneFlags; var tmpS3DData = texnames.Select(t => s3d[t.ToLower()]).ToList(); var material = new Entities.Material(texFlags, tmpS3DData); var mesh = new Entities.Mesh(material, vbuf, frag.Polys.Skip(off).Take(count).ToList()); obj.Meshes.Add(mesh); off += count; } } }
public void ConvertZone(Zone zone) { if (!byType.ContainsKey(54)) { return; } foreach (FragMesh frag in byType[54]) { var vbuf = new VertexBuffer(frag); var off = 0; foreach (var polytex in frag.Polytex) { var count = polytex[0]; var index = polytex[1]; if (frag.Textures.Length > 1) { throw new IndexOutOfRangeException( "WldConverter.ConvertObjects -- frag.Textures.Length > 1"); } var texnames = ((FragRef[])frag.Textures[0].Value)[index].Resolve().OfType <string>().ToList(); var texFlags = ((TexRef)((FragRef[])frag.Textures[0].Value)[index].Value).SaneFlags; var tmpS3DData = texnames.Select(t => s3d[t.ToLower()]).ToList(); // The first param was texFlags, but it was always set to 0, so I'm setting it to 0. var material = new Entities.Material(texFlags, tmpS3DData); var mesh = new Entities.Mesh(material, vbuf, frag.Polys.Skip(off).Take(count).ToList()); zone.ZoneObj.Meshes.Add(mesh); off += count; } } }
public void get_material_from_service_material() { // Setup ClearSubscriptions(); var mock = new Mock(); var serviceMaterialsDatabase = mock.PrepareServiceMaterialsDependencies(); new Autonomy().Activate(); var profileId = new ProfileServer().GetProfile().Id; var material = new Material() { Name = SOME_TEXT, UserId = profileId }; Publish(Messages.REQUEST_SAVE_MATERIAL, material); var service = new Service() { Name = SOME_TEXT, UserId = profileId }; Publish(Messages.REQUEST_SAVE_SERVICE, service); var serviceMaterial = new ServiceMaterial() { MaterialId = material.Id, ServiceId = service.Id, Quantity = 1, UserId = profileId }; Publish(Messages.REQUEST_SAVE_SERVICE_MATERIAL, serviceMaterial); // Test Material materialResult = null; Subscribe(Messages.REQUEST_SERVICE_MATERIAL_RESPONSE, obj => materialResult = obj as Material); Publish(Messages.REQUEST_SERVICE_MATERIAL, material.Id); // Verify var expected = material == materialResult; Assert.IsTrue(expected); }
protected abstract void Add(Material material);
protected abstract void Update(Material material);
public bool Validate(Material material) => !string.IsNullOrWhiteSpace(material.Name) && !string.IsNullOrWhiteSpace(material.UnitType) && material.BaseCost >= 0 && material.Quantity >= 0 && material.MarkupPrice >= 0;
protected override void Update(Material material) => _databaseConnection.Update(material);
string UpdateBlock(string materialTemplate, Material material) { var materialBlock = new StringBuilder(materialTemplate); materialBlock = materialBlock.Replace("~MATERIAL_NAME~", material.Name); materialBlock = materialBlock.Replace("~MATERIAL_DESCRIPTION~", material.Description); materialBlock = materialBlock.Replace("~MATERIAL_QUANTITY~", string.Format("{0} {1}", material.Quantity, material.UnitType)); materialBlock = materialBlock.Replace("~MATERIAL_COST~", (material.MarkupPrice * material.Quantity).ToString()); return materialBlock.ToString(); }
protected override void Add(Material material) => Materials.Add(material);
protected override void Add(Material material) => _databaseConnection.Insert(material);
protected override void BreakPromises() { _messagebus.Unsubscribe(Messages.REQUEST_SELECTED_MATERIAL_RESPONSE, obj => _materialToUpdate = obj as Material); _messagebus.Unsubscribe(Messages.REQUEST_SAVE_MATERIAL_RESPONSE, obj => IsUpdated = (bool)obj); }
public void Add(int key, Material material) { materials.Add(key, material); }
protected abstract void SaveData(Material material);
protected override void SaveData(Material material) => _database.OnSave(material);