Ejemplo n.º 1
0
        /// <summary>
        /// Reads ContinuousPrintStyleViewModel properties from XML and creates a ContinuousPrintStyleViewModel with said properties.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public override void DeserializePrintStyle(XmlReader xmlReader, PrintStyleViewModel printStyleViewModel)
        {
            ContinuousPrintStyleViewModel continuousPrintStyleViewModel = (ContinuousPrintStyleViewModel)printStyleViewModel;

            //Read through each element of the XML string and populate each property of the Continuous Print Style.
            while (xmlReader.Read())
            {
                //Skip through newlines (this program's XML Writer uses newlines).
                if ((xmlReader.Name != "\n") && (!String.IsNullOrWhiteSpace(xmlReader.Name)))
                {
                    //End method if the end of "ContinuousPrintStyle" element is reached.
                    if ((xmlReader.Name == "ContinuousPrintStyle") && (xmlReader.NodeType == XmlNodeType.EndElement))
                    {
                        return;
                    }

                    switch (xmlReader.Name)
                    {
                    case "MotorizedDispensePerMmMovement":
                        continuousPrintStyleViewModel.MotorizedDispensePerMmMovement = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "MotorizedDispenseRetractionDistance":
                        continuousPrintStyleViewModel.MotorizedDispenseRetractionDistance = xmlReader.ReadElementContentAsDouble();
                        break;

                    default:
                        base.ReportErrorUnrecognizedElement(xmlReader);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Writes Continuous Print Style properties into XML.
        /// </summary>
        /// <param name="printStyleViewModel"></param>
        /// <returns></returns>
        /// <remarks>
        /// Outmost element should be "ContinuousPrintStyle".
        /// Outmost element start and close should be handled by this function's caller.
        /// </remarks>
        public override void SerializePrintStyle(XmlWriter xmlWriter, PrintStyleViewModel printStyleViewModel)
        {
            ContinuousPrintStyleViewModel continuousPrintStyleViewModel = (ContinuousPrintStyleViewModel)printStyleViewModel;

            //Only element should be "ContinousPrintStyle".
            xmlWriter.WriteStartElement("ContinuousPrintStyle", " ");

            //Motorized Dispense Per Mm Movement.
            xmlWriter.WriteElementString("MotorizedDispensePerMmMovement", continuousPrintStyleViewModel.MotorizedDispensePerMmMovement.ToString());

            //Motorized Retraction Distance.
            xmlWriter.WriteElementString("MotorizedDispenseRetractionDistance", continuousPrintStyleViewModel.MotorizedDispenseRetractionDistance.ToString());

            //Close outmost element "ContinousPrintStyle".
            xmlWriter.WriteEndElement();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Writes DropletPrintStyleViewModel properties into XML.
        /// </summary>
        /// <param name="printStyleViewModel"></param>
        /// <returns></returns>
        /// /// <remarks>
        /// Outmost element should be "DropletPrintStyle".
        /// Outmost element start and close should be handled by this function's caller.
        /// </remarks>
        public override void SerializePrintStyle(XmlWriter xmlWriter, PrintStyleViewModel printStyleViewModel)
        {
            DropletPrintStyleViewModel dropletPrintStyleViewModel = (DropletPrintStyleViewModel)printStyleViewModel;

            //Outmost element should be "DropletPrintStyle".
            xmlWriter.WriteStartElement("DropletPrintStyle");

            //Motorized Dispense Distance.
            xmlWriter.WriteElementString("MotorizedDispenseDistance", dropletPrintStyleViewModel.MotorizedDispenseDistance.ToString());

            //Motorized Dispense Max Speed.
            xmlWriter.WriteElementString("MotorizedDispenseMaxSpeed", dropletPrintStyleViewModel.MotorizedDispenseMaxSpeed.ToString());

            //Motorized Dispense Acceleration.
            xmlWriter.WriteElementString("MotorizedDispenseAcceleration", dropletPrintStyleViewModel.MotorizedDispenseAcceleration.ToString());

            //Valve Open Time.
            xmlWriter.WriteElementString("ValveOpenTime", dropletPrintStyleViewModel.ValveOpenTime.ToString());

            //Interpolate Distance.
            xmlWriter.WriteElementString("InterpolateDistance", dropletPrintStyleViewModel.InterpolateDistance.ToString());

            //Gradient Shape.
            xmlWriter.WriteElementString("GradientShape", dropletPrintStyleViewModel.GradientShape.ToString());

            //Gradient Scaling.
            xmlWriter.WriteElementString("GradientScaling", dropletPrintStyleViewModel.GradientScaling.ToString());

            //Percent per Mm.
            xmlWriter.WriteElementString("PercentPerMm", dropletPrintStyleViewModel.PercentPerMm.ToString());

            //Gradient Coordinates.
            xmlWriter.WriteElementString("X1", dropletPrintStyleViewModel.X1.ToString());
            xmlWriter.WriteElementString("Y1", dropletPrintStyleViewModel.Y1.ToString());
            xmlWriter.WriteElementString("Z1", dropletPrintStyleViewModel.Z1.ToString());
            xmlWriter.WriteElementString("X2", dropletPrintStyleViewModel.X2.ToString());
            xmlWriter.WriteElementString("Y2", dropletPrintStyleViewModel.Y2.ToString());
            xmlWriter.WriteElementString("Z2", dropletPrintStyleViewModel.Z2.ToString());
            xmlWriter.WriteElementString("X3", dropletPrintStyleViewModel.X3.ToString());
            xmlWriter.WriteElementString("Y3", dropletPrintStyleViewModel.Y3.ToString());
            xmlWriter.WriteElementString("Z3", dropletPrintStyleViewModel.Z3.ToString());

            //Close outmost element "DropletPrintStyle".
            xmlWriter.WriteEndElement();
        }
        /// <summary>
        /// Reads DropletPrintStyleViewModel properties from XML and creates a DropletPrintStyleViewModel with said properties.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public override void DeserializePrintStyle(XmlReader xmlReader, PrintStyleViewModel printStyleViewModel)
        {
            DropletPrintStyleViewModel dropletPrintStyleViewModel = (DropletPrintStyleViewModel)printStyleViewModel;

            //Read through each element of the XML string and populate each property of the Droplet Print Style.
            while (xmlReader.Read())
            {
                //Skip through newlines (this program's XML Writer uses newlines).
                if ((xmlReader.Name != "\n") && (!String.IsNullOrWhiteSpace(xmlReader.Name)))
                {
                    //End method if the end of "DropletPrintStyle" element is reached.
                    if ((xmlReader.Name == "DropletPrintStyle") && (xmlReader.NodeType == XmlNodeType.EndElement))
                    {
                        return;
                    }

                    switch (xmlReader.Name)
                    {
                    case "MotorizedDispenseDistance":
                        dropletPrintStyleViewModel.MotorizedDispenseDistance = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "MotorizedDispenseMaxSpeed":
                        dropletPrintStyleViewModel.MotorizedDispenseMaxSpeed = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "MotorizedDispenseAcceleration":
                        dropletPrintStyleViewModel.MotorizedDispenseAcceleration = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "ValveOpenTime":
                        dropletPrintStyleViewModel.ValveOpenTime = xmlReader.ReadElementContentAsInt();
                        break;

                    case "InterpolateDistance":
                        dropletPrintStyleViewModel.InterpolateDistance = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "GradientShape":
                        dropletPrintStyleViewModel.GradientShape = (GradientShape)Enum.Parse(typeof(GradientShape), xmlReader.ReadElementContentAsString(), false);
                        break;

                    case "GradientScaling":
                        dropletPrintStyleViewModel.GradientScaling = (GradientScaling)Enum.Parse(typeof(GradientScaling), xmlReader.ReadElementContentAsString(), false);
                        break;

                    case "PercentPerMm":
                        dropletPrintStyleViewModel.PercentPerMm = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "X1":
                        dropletPrintStyleViewModel.X1 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Y1":
                        dropletPrintStyleViewModel.Y1 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Z1":
                        dropletPrintStyleViewModel.Z1 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "X2":
                        dropletPrintStyleViewModel.X2 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Y2":
                        dropletPrintStyleViewModel.Y2 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Z2":
                        dropletPrintStyleViewModel.Z2 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "X3":
                        dropletPrintStyleViewModel.X3 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Y3":
                        dropletPrintStyleViewModel.Y3 = xmlReader.ReadElementContentAsDouble();
                        break;

                    case "Z3":
                        dropletPrintStyleViewModel.Z3 = xmlReader.ReadElementContentAsDouble();
                        break;

                    default:
                        base.ReportErrorUnrecognizedElement(xmlReader);
                        break;
                    }
                }
            }
        }
 public abstract void SerializePrintStyle(XmlWriter xmlWriter, PrintStyleViewModel printStyleViewModel);
Ejemplo n.º 6
0
 public abstract void DeserializePrintStyle(XmlReader xmlReader, PrintStyleViewModel printStyleViewModel);