示例#1
0
        public void Load()
        {
            xml.OpenSection("Counter");
            if (!int.TryParse(xml.Read("ProcessedHGACount", "0"), out processedHGACount))
            {
                processedHGACount = 0;
            }
            if (!double.TryParse(xml.Read("CycleTime", "0.0"), out cycleTime))
            {
                cycleTime = 0;
            }
            if (!int.TryParse(xml.Read("UPH", "0"), out uph))
            {
                uph = 0;
            }
            if (!int.TryParse(xml.Read("UPH2", "0"), out uph2))
            {
                uph2 = 0;
            }
            if (!DateTime.TryParse(xml.Read("StartDateTime", DateTime.Now.ToString()), out startDateTime))
            {
                startDateTime = DateTime.Now;
            }
            if (!int.TryParse(xml.Read("SamplingCounter", "0"), out _samplingCounter))
            {
                _samplingCounter = 0;
            }
            if (!DateTime.TryParse(xml.Read("LastSamplingReset", DateTime.Now.ToString()), out _lastSamplingCounterReset))
            {
                _lastSamplingCounterReset = DateTime.Now;
            }
            CarrierTriggeringData.Load("CarrierTriggeringData", xml);

            if (!int.TryParse(xml.Read("LastActiveSamplingPartCount", "0"), out _lastActiveSamplingPartCount))
            {
                _lastActiveSamplingPartCount = processedHGACount;
            }
            if (!int.TryParse(xml.Read("WRBridgeRunningPercentage", "0.0"), out _wrBridgeRunningPercentage))
            {
                _wrBridgeRunningPercentage = 0;
            }
            if (!double.TryParse(xml.Read("LastWRBridgePercentage", "0.0"), out _lastWRBridgePercentage))
            {
                _lastWRBridgePercentage = 0.0;
            }
            if (!int.TryParse(xml.Read("WriterBridgePartRunCounter", "0"), out _writerBridgePartRunCounter))
            {
                _writerBridgePartRunCounter = 0;
            }
            xml.CloseSection();
        }
示例#2
0
 public void Save()
 {
     foreach (KeyValuePair <string, FormPosition> kvp in _fromLayoutTalbe)
     {
         _xml.OpenSection(kvp.Key);
         _xml.Write("X", kvp.Value.X);
         _xml.Write("Y", kvp.Value.Y);
         _xml.Write("Width", kvp.Value.Width);
         _xml.Write("Height", kvp.Value.Height);
         _xml.Write("WindowState", kvp.Value.WindowState);
         _xml.CloseSection();
     }
     _xml.Save();
 }
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section + "/Sort" + SortName);
     MinSpec = xml.Read("MinSpec", 0.00);
     MaxSpec = xml.Read("MaxSpec", 0.00);
     xml.CloseSection();
 }
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section + "/Sort" + SortName);
     xml.Write("MinSpec", MinSpec);
     xml.Write("MaxSpec", MaxSpec);
     xml.CloseSection();
 }
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section + "/DetectCondition" + Name);
     RowTopic = xml.Read("RowTopic", string.Empty);
     ColTopic = xml.Read("ColTopic", string.Empty);
     xml.CloseSection();
 }
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section + "/DetectCondition" + Name);
     xml.Write("RowTopic", RowTopic);
     xml.Write("ColTopic", ColTopic);
     xml.CloseSection();
 }
        public void Load(SettingsXml xml, string section)
        {
            HGAProduct.Clear();
            int  pid = 0;
            bool end = false;

            while (!end)
            {
                pid++;
                var pidname = string.Format("PID{0}", pid.ToString());
                xml.OpenSection(section);
                var name = xml.Read(pidname + "/ProductName", string.Empty);

                if (name != String.Empty)
                {
                    HGAProductType GetPid = new HGAProductType(name);
                    GetPid.ConversionBoardID = xml.Read(pidname + "/ConversionBoardID", 0);
                    GetPid.HGATailType       = (HGAProductTailType)Enum.Parse(typeof(HGAProductTailType),
                                                                              xml.Read(pidname + "/HGAProductTailType", HGAProductTailType.Unknown.ToString()));
                    GetPid.TestProbeType    = xml.Read(pidname + "/TestProbeType", String.Empty);
                    GetPid.RecipeGlobalPath = xml.Read(pidname + "/GlobalPath", String.Empty);
                    HGAProduct.Add(GetPid);
                }
                else
                {
                    end = true;
                }
            }

            xml.CloseSection();
        }
示例#8
0
 public void Save(SettingsXml xml, string section)
 {
     xml.OpenSection(section);
     //xml.Write("TailType", CurrentInstalledTestTailType.ToString());
     xml.CloseSection();
     xml.Save();
 }
示例#9
0
 public void Load(SettingsXml xml, string section)
 {
     xml.OpenSection(section);
     //CurrentInstalledTestTailType = (HGAProductTailType)Enum.Parse(typeof(HGAProductTailType),
     //xml.Read("TailType", HGAProductTailType.Unknown.ToString()));
     xml.CloseSection();
 }
 public void Load()
 {
     xml.OpenSection("Counter");
     if (!int.TryParse(xml.Read("InputEEDycemCleaningCount", "0"), out inputEEDycemCleaningCount))
     {
         inputEEDycemCleaningCount = 0;
     }
     if (!int.TryParse(xml.Read("OutputEEDycemCleaningCount", "0"), out outputEEDycemCleaningCount))
     {
         outputEEDycemCleaningCount = 0;
     }
     if (!DateTime.TryParse(xml.Read("StartDateTime", DateTime.Now.ToString()), out startDateTime))
     {
         startDateTime = DateTime.Now;
     }
     xml.CloseSection();
 }
        public void Save(string section, SettingsXml xml)
        {
            xml.OpenSection(section + "/Marker");
            xml.Write("markerType", (int)_markerType);
            xml.Write("markerWidth", _markerWidth);
            xml.Write("markerHeight", _markerHeight);
            xml.Write("XYAxesHatchSize", _xyAxesHatchSize);
            xml.Write("XYAxesHatchInc", _xyAxesHatchInc);
            xml.Write("ShowCrossHair", _showCrossHair);
            xml.Write("ShowAxes", _showAxes);
            xml.CloseSection();

            xml.OpenSection(section + "/Measurement");
            xml.Write("DistMeasureLineStartX", _distMeasureLineStartX);
            xml.Write("DistMeasureLineStartY", _distMeasureLineStartY);
            xml.Write("DistMeasureLineEndX", _distMeasureLineEndX);
            xml.Write("DistMeasureLineEndY", _distMeasureLineEndY);
            xml.Write("ShowMeasurementLine", _showMeasurementLine);
            xml.CloseSection();
        }
        public void Load(string section, SettingsXml xml)
        {
            xml.OpenSection(section + "/Marker");
            _markerType      = (MarkerType)xml.Read("markerType", 0);
            _markerWidth     = xml.Read("markerWidth", _defaultMarkerWidth);
            _markerHeight    = xml.Read("markerHeight", _defatulMarkerHeight);
            _xyAxesHatchSize = (double)xml.Read("XYAxesHatchSize", _defaultHatchSize);
            _xyAxesHatchInc  = (double)xml.Read("XYAxesHatchInc", _defaultHatchIncrement);
            _showCrossHair   = (bool)xml.Read("ShowCrossHair", false);
            _showAxes        = (bool)xml.Read("ShowAxes", false);
            xml.CloseSection();

            xml.OpenSection(section + "/Measurement");
            _distMeasureLineStartX = (double)xml.Read("DistMeasureLineStartX", _defaultLineStartX);
            _distMeasureLineStartY = (double)xml.Read("DistMeasureLineStartY", _defaultLineStartY);
            _distMeasureLineEndX   = (double)xml.Read("DistMeasureLineEndX", _defaultLineEndX);
            _distMeasureLineEndY   = (double)xml.Read("DistMeasureLineEndY", _defaultLineEndY);
            _showMeasurementLine   = (bool)xml.Read("ShowMeasurementLine", false);
            xml.CloseSection();
        }
示例#13
0
        /// <summary>
        /// Saves to an xml obejct
        /// </summary>
        /// <param name="section"></param>
        /// <param name="xml"></param>
        public void Save(string section, SettingsXml xml)
        {
            xml.OpenSection(section + "/" + _name);
            xml.Write("Exposure", _exposure);
            xml.Write("Brightness", _brightness);
            xml.Write("Contrast", _contrast);
            xml.Write("RingLightIntensity", _ringLightIntensity);
            xml.Write("ThruLightIntensity", _thruLightIntensity);
            xml.CloseSection();

            _imageGraphics.Save(section + "/" + _name, xml);
        }
示例#14
0
        public void Load(string section, SettingsXml xml)
        {
            xml.OpenSection(section + "/" + _name);
            _exposure           = xml.Read("Exposure", 40.0);
            _brightness         = xml.Read("Brightness", 0.5);
            _contrast           = xml.Read("Contrast", 0.5);
            _ringLightIntensity = xml.Read("RingLightIntensity", 0.0);
            _thruLightIntensity = xml.Read("ThruLightIntensity", 0.0);
            xml.CloseSection();

            _imageGraphics.Load(section + "/" + _name, xml);
        }
示例#15
0
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     LastCheckByHourActive       = xml.Read("LastCheckByHourActive", DateTime.Now.ToString());
     LastCheckByPartCountActive  = xml.Read("LastCheckByPartCountActive", 1);
     EnabledResistanceCheck      = xml.Read("EnabledResistanceCheck", false);
     OverallTestResult           = xml.Read("OverallTestResult", false);
     CheckByHourCounter          = xml.Read("CheckByHourCounter", 0.0);
     CheckByPartCounter          = xml.Read("CheckByPartCounter", 0);
     ResistanceCriticalActivated = xml.Read("ResistanceCriticalActivated", false);
     IsRetestProcessRequired     = xml.Read("IsRetestProcessRequired", false);
     CheckType = (ResistanceCheckType)Enum.Parse(typeof(ResistanceCheckType), xml.Read("Type", ResistanceCheckType.Unknown.ToString()));
     xml.CloseSection();
 }
示例#16
0
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     xml.Write("LastCheckByHourActive", _lastCheckByHourActive);
     xml.Write("LastCheckByPartCountActive", _lastCheckByPartCountActive);
     xml.Write("EnabledResistanceCheck", _enabledCheck);
     xml.Write("OverallTestResult", _overallTestResult);
     xml.Write("CheckByHourCounter", _checkByHourCounter);
     xml.Write("CheckByPartCounter", _checkByPartCounter);
     xml.Write("ResistanceCriticalActivated", _resistanceCriticalAtivated);
     xml.Write("IsRetestProcessRequired", _isRetestProcessRequired);
     xml.Write("Type", _checkType.ToString());
     xml.CloseSection();
 }
示例#17
0
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     _lastActiveDate              = xml.Read("LastActiveDate", string.Empty);
     _counterBeforeTrig           = xml.Read("CounterBeforeTrig", 0);
     _counterAfterTrig            = xml.Read("CounterAfterTriggering", 0);
     _testPassCounter             = xml.Read("TestPassCounter", 0);
     _testFailCounter             = xml.Read("TestFailCounter", 0);
     _errorCumulative             = xml.Read("ErrorCumulative", 0.00);
     _totalPartRunCounter         = xml.Read("TotalPartRunCounter", 0);
     _buyOffProcessFinished       = xml.Read("BuyOffProcessFinished", true);
     _buyOffProcessStarted        = xml.Read("BuyOffProcessStarted", false);
     _criticalTriggeringActivated = xml.Read("CriticalTriggeringActivated", false);
     _samplingOverPercentageTriggeringActivated = xml.Read("SamplingTriggeringOverPercentage", false);
     xml.CloseSection();
 }
示例#18
0
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     xml.Write("LastActiveDate", _lastActiveDate);
     xml.Write("CounterBeforeTrig", _counterBeforeTrig);
     xml.Write("CounterAfterTriggering", _counterAfterTrig);
     xml.Write("TestPassCounter", _testPassCounter);
     xml.Write("TestFailCounter", _testFailCounter);
     xml.Write("ErrorCumulative", _errorCumulative);
     xml.Write("TotalPartRunCounter", _totalPartRunCounter);
     xml.Write("BuyOffProcessFinished", _buyOffProcessFinished);
     xml.Write("BuyOffProcessStarted", _buyOffProcessStarted);
     xml.Write("CriticalTriggeringActivated", _criticalTriggeringActivated);
     xml.Write("SamplingTriggeringOverPercentage", _samplingOverPercentageTriggeringActivated);
     xml.CloseSection();
 }
示例#19
0
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     Enabled                        = xml.Read("Enabled", Enabled);
     EnableAlertMsg                 = xml.Read("EnableAlertMag", EnableAlertMsg);
     YeildTarget                    = xml.Read("YeildTarget", 0.00);
     YeildLimit                     = xml.Read("YeildLimit", 0.00);
     Alpha                          = xml.Read("Alpha", 0.00);
     DefectCounterLimit             = xml.Read("DefectCounterLimit", 0);
     TestRunGroup                   = xml.Read("TestRunGroup", 0);
     TimeToIgnoreAfterRepair        = xml.Read("TimeToIgnoreAfterRepair", 0);
     PartCounterYieldPerShortPeriod = xml.Read("PartCounterYieldPerShortPeriod", 100);
     PartCounterYieldPerLongPeriod  = xml.Read("PartCounterYieldPerLongPeriod", 100);
     DelayForReleaseCarrier         = xml.Read("DelayForReleaseCarrier", 0.0);
     xml.CloseSection();
 }
示例#20
0
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     xml.Write("Enabled", Enabled);
     xml.Write("EnableAlertMag", EnableAlertMsg);
     xml.Write("YeildTarget", YeildTarget);
     xml.Write("YeildLimit", YeildLimit);
     xml.Write("Alpha", Alpha);
     xml.Write("DefectCounterLimit", DefectCounterLimit);
     xml.Write("TestRunGroup", TestRunGroup);
     xml.Write("TimeToIgnoreAfterRepair", TimeToIgnoreAfterRepair);
     xml.Write("PartCounterYieldPerShortPeriod", PartCounterYieldPerShortPeriod);
     xml.Write("PartCounterYieldPerLongPeriod", PartCounterYieldPerLongPeriod);
     xml.Write("DelayForReleaseCarrier", DelayForReleaseCarrier);
     xml.CloseSection();
 }
        public void Save()
        {
            if (OnSettingsChanged != null)
            {
                OnSettingsChanged(this, null);
            }

            _xml.OpenSection("TestProbe");
            _xml.Write("COMPort", TestProbe.COMPort.ToString());
            _xml.Write("BaudRate", TestProbe.BaudRate.ToString());
            _xml.Write("StopBits", TestProbe.StopBits.ToString());
            _xml.Write("Parity", TestProbe.Parity.ToString());
            _xml.Write("DataBits", TestProbe.DataBits.ToString());
            _xml.CloseSection();

            _xml.Save();
        }
        public void Save(SettingsXml xml, string section)
        {
            int pid = 0;

            foreach (HGAProductType item in HGAProduct)
            {
                pid++;
                var pidname = string.Format("PID{0}", pid.ToString());
                xml.OpenSection(section);
                xml.Write(pidname + "/ProductName", item.Name);
                xml.Write(pidname + "/ConversionBoardID", item.ConversionBoardID.ToString());
                xml.Write(pidname + "/HGAProductTailType", item.HGATailType.ToString());
                xml.Write(pidname + "/TestProbeType", item.TestProbeType);
                xml.Write(pidname + "/GlobalPath", item.RecipeGlobalPath);
                xml.CloseSection();
            }
            xml.Save();
        }
示例#23
0
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     TicFailCounter                  = xml.Read("TicFailCounter", 0);
     HstFailCounter                  = xml.Read("HstFailCounter", 0);
     TicDefactCounter                = xml.Read("TicDefactCounter", 0);
     HstDefactCounter                = xml.Read("HstDefactCounter", 0);
     TicGoodPartCounter              = xml.Read("TicGoodPartCounter", 0);
     HstGoodPartCounter              = xml.Read("HstGoodPartCounter", 0);
     AdaptivePartRunCounter          = xml.Read("AdaptivePartRunCounter", 0);
     AdaptiveDefectCounter           = xml.Read("AdaptiveDefectCounter", 0);
     LastSaveLogTime                 = DateTime.ParseExact(xml.Read("LastSaveLogTime", (System.DateTime.Today.AddDays(-1)).ToString("dd-MMM-yy:HH:mm:ss")), "dd-MMM-yy:HH:mm:ss", null);
     MCDownTriggering                = xml.Read("MCDownTriggering", 0);
     TicHighPercentTriggeringCounter = 0;
     HstHighPercentTriggeringCounter = 0;
     InternalTriggerCounter          = xml.Read("InternalTriggerCounter", 0);
     uTICMachineName                 = xml.Read("uTICMachineName", "");
     xml.CloseSection();
 }
示例#24
0
        public void Save(string section, SettingsXml xml)
        {
            xml.OpenSection(section);
            xml.Write("TicFailCounter", TicFailCounter);
            xml.Write("HstFailCounter", HstFailCounter);
            xml.Write("TicDefactCounter", TicDefactCounter);
            xml.Write("HstDefactCounter", HstDefactCounter);
            xml.Write("TicGoodPartCounter", TicGoodPartCounter);
            xml.Write("HstGoodPartCounter", HstGoodPartCounter);
            xml.Write("AdaptivePartRunCounter", AdaptivePartRunCounter);
            xml.Write("AdaptiveDefectCounter", AdaptiveDefectCounter);
            xml.Write("LastSaveLogTime", LastSaveLogTime.ToString("dd-MMM-yy:HH:mm:ss"));
            xml.Write("MCDownTriggering", MCDownTriggering);
            xml.Write("TicHighPercentTriggeringCounter", TicHighPercentTriggeringCounter);
            xml.Write("HstHighPercentTriggeringCounter", HstHighPercentTriggeringCounter);
            xml.Write("InternalTriggerCounter", InternalTriggerCounter);
            xml.Write("uTICMachineName", uTICMachineName);

            xml.CloseSection();
        }
示例#25
0
 public void Save(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     xml.Write("TrigerByCarrierEnable", _triggeringByCarrierEnable);
     xml.Write("TrigerByCarrierCount", _triggerByCarrierCount);
     xml.Write("TriggerByCarrierHour", _triggerByCarrierHour);
     xml.Write("FailurePhase1Min", _failurePhase1Min);
     xml.Write("FailurePhase2Min", _failurePhase2Min);
     xml.Write("PerCarrierCounter", _perCarrierCounter);
     xml.Write("PerHourCounter", _perHourCounter);
     xml.Write("TotalCarrierForBuyOff", _totalBuyoffCarrier);
     xml.Write("TriggerByErrorCodeEnabled", _triggeringByErrorCodeEnable);
     xml.Write("TriggerByErrorCodePercent", _errorCodeFailurePercent);
     xml.Write("TriggerByErrorCodePartRunCounter", _errorCodePartRunCounter);
     xml.Write("TriggerByErrorCodeFailureCounter", _errorCodeFailureCounter);
     xml.Write("ErrorCodeTriggeringActivate", _errorCodeTriggeringActivate);
     xml.Write("TriggerByErrorCodePartPerPeriod", _errorCodePartPerPeriod);
     xml.Write("DoubleTestDelayTime", _doubletestdelayTime);
     xml.CloseSection();
 }
示例#26
0
 public void Load(string section, SettingsXml xml)
 {
     xml.OpenSection(section);
     TriggerByCarrierEnabled          = xml.Read("TrigerByCarrierEnable", false);
     TrigerByCarrierCount             = xml.Read("TrigerByCarrierCount", 1);
     TriggerByCarrierHour             = xml.Read("TriggerByCarrierHour", 0);
     FailurePhase1Min                 = xml.Read("FailurePhase1Min", 0.0);
     FailurePhase2Min                 = xml.Read("FailurePhase2Min", 0.0);
     PerCarrierCounter                = xml.Read("PerCarrierCounter", 0);
     PerHourCounter                   = xml.Read("PerHourCounter", 0);
     TotalCarrierForBuyOff            = xml.Read("TotalCarrierForBuyOff", 1);
     TriggerByErrorCodeEnabled        = xml.Read("TriggerByErrorCodeEnabled", false);
     TriggerByErrorCodePercent        = xml.Read("TriggerByErrorCodePercent", 0.0);
     TriggerByErrorCodePartRunCounter = xml.Read("TriggerByErrorCodePartRunCounter", 0);
     TriggerByErrorCodeFailureCounter = xml.Read("TriggerByErrorCodeFailureCounter", 0);
     ErrorCodeTriggeringActivate      = xml.Read("ErrorCodeTriggeringActivate", false);
     TriggerByErrorCodePartPerPeriod  = xml.Read("TriggerByErrorCodePartPerPeriod", 0);
     DoubleTestDelayMillisec          = xml.Read("DoubleTestDelayTime", 400);
     xml.CloseSection();
 }
        public void Load()
        {
            LoadUsers();

            string COMPortSettingsFilePath = string.Format("{0}BenchTestTool.config", CommonFunctions.Instance.COMPortSettingsFileDirectory);

            _xml = new SettingsXml(COMPortSettingsFilePath);
            _xml.OpenSection("TestProbe");
            TestProbe.COMPort  = (COMPortList)Enum.Parse(typeof(COMPortList), _xml.Read("COMPort", COMPortList.Unknown.ToString()));
            TestProbe.BaudRate = int.Parse(_xml.Read("BaudRate", "19200"));
            TestProbe.Parity   = (Parity)Enum.Parse(typeof(Parity), _xml.Read("Parity", Parity.None.ToString()));
            TestProbe.DataBits = int.Parse(_xml.Read("DataBits", "8"));
            TestProbe.StopBits = (StopBits)Enum.Parse(typeof(StopBits), _xml.Read("StopBits", StopBits.One.ToString()));
            _xml.CloseSection();

            if (OnSettingsChanged != null)
            {
                OnSettingsChanged(this, null);
            }
        }
示例#28
0
        public static void LoadHelper(string section, SettingsXml xml, object obj)
        {
            xml.OpenSection(section);
            foreach (PropertyInfo pi in obj.GetType().GetProperties())
            {
                // Loop through all properties and save them into config.
                if (pi.PropertyType == typeof(String))
                {
                    pi.SetValue(obj, xml.Read(pi.Name, (String)pi.GetValue(obj, null)), null);
                }

                if (pi.PropertyType == typeof(Int32))
                {
                    pi.SetValue(obj, xml.Read(pi.Name, (Int32)pi.GetValue(obj, null)), null);
                }

                if (pi.PropertyType == typeof(Double))
                {
                    pi.SetValue(obj, xml.Read(pi.Name, (Double)pi.GetValue(obj, null)), null);
                }

                if (pi.PropertyType == typeof(Boolean))
                {
                    pi.SetValue(obj, xml.Read(pi.Name, (Boolean)pi.GetValue(obj, null)), null);
                }

                if (pi.PropertyType == typeof(MoveProfileBase) && pi.CanWrite)
                {
                    MoveProfileBase mp = new MoveProfileBase();

                    mp.Acceleration = xml.Read(pi.Name + "/" + "Acceleration", 1000);
                    mp.Deceleration = xml.Read(pi.Name + "/" + "Deceleration", 1000);
                    mp.Velocity     = xml.Read(pi.Name + "/" + "Velocity", 50);
                    pi.SetValue(obj, mp, null);
                }
            }
            xml.CloseSection();
        }
示例#29
0
        public static void SaveHelper(string section, SettingsXml xml, object obj)
        {
            xml.OpenSection(section);
            // Loop through all properties of this type and read from
            // config based on property's name.

            foreach (PropertyInfo pi in obj.GetType().GetProperties())
            {
                if (pi.PropertyType == typeof(String))
                {
                    xml.Write(pi.Name, (String)pi.GetValue(obj, null));
                }

                if (pi.PropertyType == typeof(Int32))
                {
                    xml.Write(pi.Name, (Int32)pi.GetValue(obj, null));
                }

                if (pi.PropertyType == typeof(Double))
                {
                    xml.Write(pi.Name, (Double)pi.GetValue(obj, null));
                }

                if (pi.PropertyType == typeof(Boolean))
                {
                    xml.Write(pi.Name, (Boolean)pi.GetValue(obj, null));
                }

                if (pi.PropertyType == typeof(MoveProfileBase) && pi.CanWrite)
                {
                    MoveProfileBase mp = (MoveProfileBase)pi.GetValue(obj, null);
                    xml.Write(pi.Name + "/" + "Acceleration", (Double)mp.Acceleration);
                    xml.Write(pi.Name + "/" + "Deceleration", (Double)mp.Deceleration);
                    xml.Write(pi.Name + "/" + "Velocity", (Double)mp.Velocity);
                }
            }
            xml.CloseSection();
        }
示例#30
0
        public void Load()
        {
            if (HSTMachine.Workcell.HSTSettings.SetupSettingsFilePath == null)
            {
                return;
            }

            if (!File.Exists(HSTMachine.Workcell.HSTSettings.SetupSettingsFilePath))
            {
                File.Create(HSTMachine.Workcell.HSTSettings.SetupSettingsFilePath).Dispose();
                return;
            }

            _xml = new SettingsXml(HSTMachine.Workcell.HSTSettings.SetupSettingsFilePath);
            _xml.OpenSection("Config");

            foreach (PropertyInfo pi in this.GetType().GetProperties())
            {
                if (!pi.CanWrite) // Avoid putting data to read only property such as IsAutoRecipe
                {
                    continue;
                }

                // Loop through all properties and save them into config.
                if (pi.PropertyType == typeof(String))
                {
                    pi.SetValue(this, _xml.Read(pi.Name, (String)pi.GetValue(this, null)), null);
                }

                if (pi.PropertyType == typeof(Int32))
                {
                    pi.SetValue(this, _xml.Read(pi.Name, (Int32)pi.GetValue(this, null)), null);
                }

                if (pi.PropertyType == typeof(Double))
                {
                    pi.SetValue(this, _xml.Read(pi.Name, (Double)pi.GetValue(this, null)), null);
                }

                if (pi.PropertyType == typeof(Boolean))
                {
                    pi.SetValue(this, _xml.Read(pi.Name, (Boolean)pi.GetValue(this, null)), null);
                }

                if (pi.PropertyType.IsEnum == true)
                {
                    pi.SetValue(this, _xml.Read(pi.Name, (int)pi.GetValue(this, null)), null);
                }
            }

            //EquipmentType = _xml.Read("EquipmentType", "ZCU");
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/InputEEZ/");
            MoveProfile.InputEEZ.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.InputEEZ.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.InputEEZ.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/PrecisorX/");
            MoveProfile.PrecisorX.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.PrecisorX.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.PrecisorX.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/PrecisorY/");
            MoveProfile.PrecisorY.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.PrecisorY.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.PrecisorY.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/PrecisorTheta/");
            MoveProfile.PrecisorTheta.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.PrecisorTheta.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.PrecisorTheta.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/TestProbeZ/");
            MoveProfile.TestProbeZ.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.TestProbeZ.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.TestProbeZ.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("MoveProfile/OutputEEZ/");
            MoveProfile.OutputEEZ.Acceleration = int.Parse(_xml.Read("Acceleration", "0"));
            MoveProfile.OutputEEZ.Deceleration = int.Parse(_xml.Read("Deceleration", "0"));
            MoveProfile.OutputEEZ.Velocity     = int.Parse(_xml.Read("Velocity", "0"));
            _xml.CloseSection();

            _xml.OpenSection("DelayTimer");
            Delay.VacuumOnDelay  = int.Parse(_xml.Read("VacuumOnDelay", "0"));
            Delay.VacuumOffDelay = int.Parse(_xml.Read("VacuumOffDelay", "0"));
            _xml.CloseSection();

            if (OnSettingsChanged != null)
            {
                OnSettingsChanged(this, null);
            }
        }