public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Kleur,KostPerRol,AantalKg,AantalMeter")] Filament filament)
        {
            if (id != filament.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filament);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilamentExists(filament.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(filament));
        }
Пример #2
0
        private void ButtonVoegFilamentToe_Clicked(object sender, EventArgs e)
        {
            Filament filament = new Filament();

            filament.Type  = Type.Text.ToUpper();
            filament.Kleur = Kleur.Text;
            var aantalKgDecimal = decimal.Parse(AantalKg.Text);

            filament.AantalKg = aantalKgDecimal;
            var kostPerRolDecimal = decimal.Parse(KostPerRol.Text);

            filament.KostPerRol = kostPerRolDecimal;
            Task.Run(async() =>
            {
                try
                {
                    FilamentItemDatabase database = await FilamentItemDatabase.Instance;
                    await database.SaveItemAsync(filament);
                    await Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.ToString());
                }
            });
        }
Пример #3
0
        public bool Equals(Filament b)
        {
            if (b == null || type != b.type || color != b.color)
            {
                return(false);
            }

            return(brand == b.brand);
        }
 /// <summary>
 /// Creates a clone of this instance
 /// </summary>
 /// <returns>Clone of this instance</returns>
 public object Clone()
 {
     return(new Layer
     {
         Duration = Duration,
         Height = Height,
         Filament = (float[])Filament.Clone(),
         FractionPrinted = FractionPrinted
     });
 }
        public async Task <IActionResult> Create([Bind("Id,Type,Kleur,KostPerRol,AantalKg,AantalMeter")] Filament filament)
        {
            if (ModelState.IsValid)
            {
                _context.Add(filament);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(filament));
        }
Пример #6
0
 public Task <int> SaveItemAsync(Filament item)
 {
     if (item.Id != 0)
     {
         return(Database.UpdateAsync(item));
     }
     else
     {
         return(Database.InsertAsync(item));
     }
 }
Пример #7
0
        public void TestDisplayname()
        {
            var testItem  = new Filament();
            var manufactu = new Manufacturer
            {
                Name           = "Testmanu",
                ManufacturerId = -1,
            };

            testItem.Manufacturer = manufactu;
            testItem.Color        = "MyColor";

            Assert.That(testItem.Displayname, Is.EqualTo("Testmanu - MyColor - "));
        }
Пример #8
0
 /// <summary>
 /// Creates a clone of this instance
 /// </summary>
 /// <returns>A clone of this instance</returns>
 public object Clone()
 {
     return(new ParsedFileInfo
     {
         FileName = (FileName != null) ? string.Copy(FileName) : null,
         Size = Size,
         LastModified = LastModified,
         Height = Height,
         FirstLayerHeight = FirstLayerHeight,
         LayerHeight = LayerHeight,
         NumLayers = NumLayers,
         Filament = (float[])Filament.Clone(),
         GeneratedBy = string.Copy(GeneratedBy),
         PrintTime = PrintTime,
         SimulatedTime = SimulatedTime
     });
 }
Пример #9
0
        public void removeFilament()
        {
            Task.Run(async() => {
                var item = Filament.Where(i => (i.Creator.Equals(InputCreator) && i.Color.Equals(InputColor) && typeCheck(i.Type) && i.Weight == InputWeight)).FirstOrDefault();
                if (item == null)
                {
                    MessageBox.Show("Error to add request");
                    return;
                }
                item.Count = InputCount;

                var addRequest = await repository.DeleteFilaments(item);
                if (addRequest == null)
                {
                    MessageBox.Show("Error to add request");
                }
                else
                {
                    requestFilaments();
                }
            }).Wait();
        }
Пример #10
0
        public static StudyPage InitialStudyPage()
        {
            StudyPage page = new StudyPage();

            Filament filament = FilamentOpp.GetRandomFilament();

            page.rec.Fill = (SolidColorBrush) new BrushConverter().ConvertFromString(filament.RectangleCollor.Trim());

            page.btn1.Background =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnBackColor1.Trim());
            page.btn1.Foreground =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnStringColor1.Trim());
            page.btn1.Content = filament.BtnString1.Trim();

            page.btn2.Background =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnBackColor2.Trim());
            page.btn2.Foreground =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnStringColor2.Trim());
            page.btn2.Content = filament.BtnString2.Trim();

            page.btn3.Background =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnBackColor3.Trim());
            page.btn3.Foreground =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnStringColor3.Trim());
            page.btn3.Content = filament.BtnString3.Trim();

            page.btn4.Background =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnBackColor4.Trim());
            page.btn4.Foreground =
                (SolidColorBrush) new BrushConverter().ConvertFromString(filament.BtnStringColor4.Trim());
            page.btn4.Content = filament.BtnString4.Trim();

            Instance.answer = filament.Answer;
            Instance.index  = Instance.index + 1;


            return(page);
        }
Пример #11
0
        public static void Initialize(FilamentCalcContext context)
        {
            context.Database.EnsureCreated();
            {
                // Look for any students.
                if (context.FilamentTypes.Any())
                {
                    return; // DB has been seeded
                }

                var FilamentTypes = new FilamentType[]
                {
                    new FilamentType {
                        Name = "PLA", WeightPerMM = 0.002f
                    },
                    new FilamentType {
                        Name = "PETG", WeightPerMM = 0.002f
                    },
                    new FilamentType {
                        Name = "ASA", WeightPerMM = 0.002f
                    },
                    new FilamentType {
                        Name = "ABS", WeightPerMM = 0.003f
                    },
                };
                foreach (var filamentType in FilamentTypes)
                {
                    context.FilamentTypes.Add(filamentType);
                }

                context.SaveChanges();
            }
            {
                if (context.Manufacturers.Any())
                {
                    return; // DB has been seeded
                }

                var ManufactorList = new Manufacturer[]
                {
                    new Manufacturer {
                        Name = "Material4Print", Url = "https://material4print.de"
                    },
                    new Manufacturer {
                        Name = "DasFilament"
                    },
                    new Manufacturer {
                        Name = "RedLine"
                    },
                    new Manufacturer {
                        Name = "Extrudr"
                    },
                    new Manufacturer {
                        Name = "Bavaria Filament"
                    },
                };

                foreach (var item in ManufactorList)
                {
                    context.Manufacturers.Add(item);
                }

                context.SaveChanges();
            }

            {
                if (context.Settingses.Any())
                {
                    return; // DB has been seeded
                }

                var setting = new Settings
                {
                    Energiekosts                   = (decimal)0.24,
                    MissprintChance                = 10,
                    PrinterEnergyUsageW            = 300,
                    PrinterDepricationKostsPerHour = 5
                };

                context.Settingses.Add(setting);
                context.SaveChanges();
            }

            if (Environment.GetEnvironmentVariable("SeedDemoData")?.ToUpper() == "J")
            {
                var FilamentList = new Filament[]
                {
                    new Filament {
                        Diameter = 1.75f, Color = "Black", ManufacturerId = 2, Price = 17.0f, FilamentTypeId = 1, SpoolWeight = 800f, PrintTempBed = "0 - 60 °C", PrintTempNozzle = "205 - 230 °C"
                    },
                };

                foreach (var item in FilamentList)
                {
                    context.Filaments.Add(item);
                }

                context.SaveChanges();
            }
        }
Пример #12
0
        public bool ResolveToEncodedFilament(string toResolve, out Filament filament, out int temperature)
        {
            filament    = null;
            temperature = -1;
            if (toResolve.Count <char>() != 3)
            {
                return(false);
            }

            var nullable1 = new FilamentSpool.TypeEnum?();
            var nullable2 = new FilamentConstants.Branding?();
            var nullable3 = new FilamentConstants.ColorsEnum?();
            var num       = 0;

            switch (char.ToLower(toResolve[0]))
            {
            case 'e':
                nullable1 = new FilamentSpool.TypeEnum?(FilamentSpool.TypeEnum.PLA);
                nullable2 = new FilamentConstants.Branding?(FilamentConstants.Branding.SolidInk);
                break;

            case 'k':
                nullable1 = new FilamentSpool.TypeEnum?(FilamentSpool.TypeEnum.ABS_R);
                nullable2 = new FilamentConstants.Branding?(FilamentConstants.Branding.Ink);
                break;

            case 'q':
                nullable1 = new FilamentSpool.TypeEnum?(FilamentSpool.TypeEnum.ABS);
                nullable2 = new FilamentConstants.Branding?(FilamentConstants.Branding.ExpertInk);
                break;

            case 'v':
                nullable1 = new FilamentSpool.TypeEnum?(FilamentSpool.TypeEnum.TGH);
                nullable2 = new FilamentConstants.Branding?(FilamentConstants.Branding.ToughInk);
                break;

            case 'x':
                nullable1 = new FilamentSpool.TypeEnum?(FilamentSpool.TypeEnum.PLA);
                nullable2 = new FilamentConstants.Branding?(FilamentConstants.Branding.Ink);
                break;
            }
            if (char.IsLetter(toResolve[1]) && nullable1.HasValue)
            {
                num = (char.ToLower(toResolve[1]) - 97) * 5 + 170;
                FilamentConstants.Temperature.MaxMin maxMin = FilamentConstants.Temperature.MaxMinForFilamentType(nullable1.Value);
                if (num < (double)maxMin.Min)
                {
                    num = (int)maxMin.Min;
                }

                if (num > (double)maxMin.Max)
                {
                    num = (int)maxMin.Max;
                }
            }
            if (char.IsLetter(toResolve[2]))
            {
                switch (char.ToLower(toResolve[2]))
                {
                case 's':
                case 't':
                case 'u':
                case 'v':
                    nullable3 = new FilamentConstants.ColorsEnum?(FilamentConstants.ColorsEnum.Other);
                    break;
                }
            }
            if (!nullable1.HasValue || !nullable2.HasValue || (!nullable3.HasValue || num == 0))
            {
                return(false);
            }

            filament    = new Filament(nullable1.Value, nullable3.Value, toResolve, nullable2.Value);
            temperature = num;
            return(true);
        }
Пример #13
0
 public Task <int> DeleteItemAsync(Filament item)
 {
     return(Database.DeleteAsync(item));
 }
Пример #14
0
 public WijzigFilament(Filament filament)
 {
     InitializeComponent();
     this.filament = filament;
     VulGegevensIn();
 }
Пример #15
0
 public Filament(Filament other)
 {
     type    = other.type;
     codeStr = other.codeStr;
     color   = other.color;
 }