Ejemplo n.º 1
0
        public static Printer3d GetPrinterFromInstance(New3DPrinterViewModel instance, Printer3d printer = null)
        {
            Printer3d temp = printer ?? new Printer3d();

            try
            {
                temp.Id    = instance.Id;
                temp.Price = instance.Price;
                temp.Type  = instance.Type;
                //temp.Supplier = instance.Supplier;
                temp.Manufacturer = instance.Manufacturer;
                temp.MaterialType = instance.MaterialFamily;
                temp.Model        = instance.Model;
                temp.UseFixedMachineHourRating = instance.UseFixedMachineHourRating;
                if (temp.UseFixedMachineHourRating)
                {
                    temp.HourlyMachineRate = new HourlyMachineRate()
                    {
                        FixMachineHourRate = instance.MachineHourRate
                    }
                }
                ;
                else
                {
                    temp.HourlyMachineRate = instance.MachineHourRateCalculation;
                }
                temp.BuildVolume      = instance.BuildVolume;
                temp.PowerConsumption = instance.PowerConsumption;
                temp.Uri        = instance.LinkToReorder;
                temp.Attributes = instance.Attributes.ToList();
                // Not implemented yet
                temp.Maintenances = new ObservableCollection <Maintenance3d>();
                temp.SlicerConfig = new Printer3dSlicerConfig()
                {
                    AMax_e                  = instance.AMax_e,
                    AMax_xy                 = instance.AMax_xy,
                    AMax_z                  = instance.AMax_z,
                    AMax_eExtrude           = instance.AMax_eExtrude,
                    AMax_eRetract           = instance.AMax_eRetract,
                    PrintDurationCorrection = instance.PrintDurationCorrection,
                };
            }
            catch (Exception exc)
            {
                logger.ErrorFormat(Strings.DialogExceptionFormatedContent, exc.Message, exc.TargetSite);
            }
            return(temp);
        }
Ejemplo n.º 2
0
 public async Task AddDefaultPrinter(Printer3d printer)
 {
     try
     {
         using (var client = new FirebaseClient(baseUri, new FirebaseOptions
         {
             AuthTokenAsyncFactory = () => Task.FromResult(authKey)
         }))
         {
             await client.Child("Printers").Child(printer.Name).PutAsync(printer);
         }
     }
     catch (Exception exc)
     {
     }
 }