Esempio n. 1
0
        public MaterialEditWindow(Screen screen)
            : base(screen)
        {
            DataContext = new MaterialEdit();

            ShadowOffset        = new Vector2(4);
            Padding             = new Thickness(16);
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment   = VerticalAlignment.Top;

            var stackPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            Content = stackPanel;

            diffuseColorButton = new LightColorButton(screen);
            diffuseColorButton.NameTextBlock.Text = "Diffuse color";
            diffuseColorButton.Click += OnDiffuseColorButtonClick;
            stackPanel.Children.Add(diffuseColorButton);

            specularColorButton = new LightColorButton(screen);
            specularColorButton.NameTextBlock.Text = "Specular color";
            specularColorButton.Click += OnSpecularColorButtonClick;
            stackPanel.Children.Add(specularColorButton);
        }
Esempio n. 2
0
        private async void MaterialAdd_Click(object sender, RoutedEventArgs e)
        {
            var editWindow = new MaterialEdit();

            editWindow.ShowDialog();
            await Restore();
        }
Esempio n. 3
0
        private async void MaterialEdit_Click(object sender, RoutedEventArgs e)
        {
            var se = new MaterialEdit();

            se.MaterialItem = SelectedMaterial;
            se.ShowDialog();
            await Restore();
        }
        //EDIT
        public ActionResult Edit(int id)
        {
            var service = CreateMaterialService();
            var detail  = service.GetMaterialById(id);
            var model   =
                new MaterialEdit
            {
                MaterialID   = detail.MaterialID,
                MaterialName = detail.MaterialName,
                HealthHazard = detail.HealthHazard,
            };

            return(View(model));
        }
        //UPDATE
        public bool UpdateMaterial(MaterialEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Material
                    .Single(e => e.MaterialID == model.MaterialID);

                entity.MaterialName = model.MaterialName;
                entity.HealthHazard = model.HealthHazard;

                return(ctx.SaveChanges() == 1);
            }
        }
Esempio n. 6
0
        public bool UpdateMaterial(MaterialEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Materials
                    .Single(e => e.OwnerID == _userId &&
                            e.MaterialID == model.MaterialID);
                entity.MaterialID     = model.MaterialID;
                entity.Quantity       = model.Quantity;
                entity.TypeOfMaterial = model.TypeOfMaterial;
                entity.TypeOfQuantity = model.TypeOfQuantity;
                entity.Description    = model.Description;

                return(ctx.SaveChanges() == 1);
            }
        }
        public bool UpdateMaterial(MaterialEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Materials
                    .Single(e => e.ManagerId == model.ManagerId);

                entity.JobTitle     = model.JobTitle;
                entity.LightBlueMud = model.LightBlueMud;
                entity.AllBlackMud  = model.AllBlackMud;
                entity.EightBoard   = model.EightBoard;
                entity.TenBoard     = model.TenBoard;
                entity.TwelveBoard  = model.TwelveBoard;

                entity.Screws = model.Screws;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Edit(int id, MaterialEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.MaterialID != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = CreateMaterialService();

            if (service.UpdateMaterial(model))
            {
                TempData["SaveResult"] = "Your material was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your material could not be updated.");
            return(View(model));
        }
Esempio n. 9
0
    private void Update()
    {
        Vector4 magPos = new Vector4(_magnet.transform.position.x, _magnet.transform.position.y, _magnet.transform.position.z, 0);

        MaterialEdit.SetMaterialVector(_mat, "_Mag", magPos);
    }