コード例 #1
0
        public void LoadConfigFile(XmlReader xmlReader)
        {
            string sName = string.Empty;

            while (xmlReader.Read())
            {
                switch (xmlReader.NodeType)
                {
                    case XmlNodeType.Element:
                        sName = xmlReader.Name;
                        break;
                    case XmlNodeType.Text:
                        switch (sName)
                        {
                            case "TrackingMonitor":
                                trackingMonitor = (Monitor) Enum.Parse(typeof (Monitor), xmlReader.Value);
                                break;
                            case "AreaWidth":
                                AreaWidth = Int32.Parse(xmlReader.Value);
                                break;
                            case "AreaHeight":
                                AreaHeight = Int32.Parse(xmlReader.Value);
                                break;
                            case "DistanceFromScreen":
                                DistanceFromScreen = Int32.Parse(xmlReader.Value);
                                break;
                            case "NumberOfPoints":
                                NumberOfPoints = Int32.Parse(xmlReader.Value);
                                break;
                            case "PointDuration":
                                PointDuration = Double.Parse(xmlReader.Value);
                                break;
                            case "PointTransitionDuration":
                                PointTransitionDuration = Double.Parse(xmlReader.Value);
                                break;
                            case "Acceleration":
                                Acceleration = Double.Parse(xmlReader.Value);
                                break;
                            case "Deacceleration":
                                Deacceleration = Double.Parse(xmlReader.Value);
                                break;

                            case "BackgroundColor":
                                BackgroundColor = Converter.GetColorFromString(xmlReader.Value);
                                break;
                            case "PointColor":
                                PointColor = Converter.GetColorFromString(xmlReader.Value);
                                break;
                            case "PointDiameter":
                                PointDiameter = Double.Parse(xmlReader.Value);
                                break;
                            case "UseInfantGraphics":
                                UseInfantGraphics = Boolean.Parse(xmlReader.Value);
                                break;
                            case "WaitForValidData":
                                WaitForValidData = Boolean.Parse(xmlReader.Value);
                                break;
                            case "RandomizePointOrder":
                                RandomizePointOrder = Boolean.Parse(xmlReader.Value);
                                break;
                            case "AutoAcceptPoints":
                                AutoAcceptPoints = Boolean.Parse(xmlReader.Value);
                                break;
                            case "CalibrationAlignment":
                                calibrationAlignment =
                                    (CalibrationAlignmentEnum)
                                    Enum.Parse(typeof (CalibrationAlignmentEnum), xmlReader.Value);
                                break;
                        }
                        break;
                }
            }
        }
コード例 #2
0
        public void LoadConfigFile(XmlReader xmlReader)
        {
            string sName = string.Empty;

            while (xmlReader.Read())
            {
                switch (xmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    sName = xmlReader.Name;
                    break;

                case XmlNodeType.Text:
                    switch (sName)
                    {
                    case "TrackingMonitor":
                        trackingMonitor = (Monitor)Enum.Parse(typeof(Monitor), xmlReader.Value);
                        break;

                    case "AreaWidth":
                        AreaWidth = Int32.Parse(xmlReader.Value);
                        break;

                    case "AreaHeight":
                        AreaHeight = Int32.Parse(xmlReader.Value);
                        break;

                    case "DistanceFromScreen":
                        DistanceFromScreen = Int32.Parse(xmlReader.Value);
                        break;

                    case "NumberOfPoints":
                        NumberOfPoints = Int32.Parse(xmlReader.Value);
                        break;

                    case "PointDuration":
                        PointDuration = Double.Parse(xmlReader.Value);
                        break;

                    case "PointTransitionDuration":
                        PointTransitionDuration = Double.Parse(xmlReader.Value);
                        break;

                    case "Acceleration":
                        Acceleration = Double.Parse(xmlReader.Value);
                        break;

                    case "Deacceleration":
                        Deacceleration = Double.Parse(xmlReader.Value);
                        break;

                    case "BackgroundColor":
                        BackgroundColor = Converter.GetColorFromString(xmlReader.Value);
                        break;

                    case "PointColor":
                        PointColor = Converter.GetColorFromString(xmlReader.Value);
                        break;

                    case "PointDiameter":
                        PointDiameter = Double.Parse(xmlReader.Value);
                        break;

                    case "UseInfantGraphics":
                        UseInfantGraphics = Boolean.Parse(xmlReader.Value);
                        break;

                    case "WaitForValidData":
                        WaitForValidData = Boolean.Parse(xmlReader.Value);
                        break;

                    case "RandomizePointOrder":
                        RandomizePointOrder = Boolean.Parse(xmlReader.Value);
                        break;

                    case "AutoAcceptPoints":
                        AutoAcceptPoints = Boolean.Parse(xmlReader.Value);
                        break;

                    case "CalibrationAlignment":
                        calibrationAlignment =
                            (CalibrationAlignmentEnum)
                            Enum.Parse(typeof(CalibrationAlignmentEnum), xmlReader.Value);
                        break;
                    }
                    break;
                }
            }
        }