Esempio n. 1
0
        public object Clone()
        {
            ConstantSetting ret = new ConstantSetting();

            if (ConstantList != null)
                for (int i = 0; i < this.ConstantList.Length; i++)
                {
                    ret.ConstantList[i] = (ConstantData)this.ConstantList[i].Clone();
                }

            return ret;
        }
Esempio n. 2
0
 /// <summary>
 /// revert to last save
 /// </summary>
 public override void Revert()
 {
     ConstantSetting data = new ConstantSetting();
     if (this.oldValue == null)
     {
         if (System.IO.File.Exists(this.FilePath))
         {
             this.oldValue = (ConstantSetting)ConstantSetting.Deserialize(this.FilePath);
         }
         else
         {
             this.oldValue = new ConstantSetting();
         }
     }
     data = (ConstantSetting)this.oldValue;
     this.ConstantList = data.ConstantList;
     this.IsUpdated = false;
 }
Esempio n. 3
0
        public CalcExpression(string Path, LogManager log)
        {
            string msg = string.Empty;
            this.log = log;
            this.calcinitFlag = false;

            this.CurFilePath = Path;
            this.xmlFilePath = Path + "\\" + DataTagSetting.FileName;
            this.xmlFilePathConstant = Path + "\\" + ConstantSetting.FileName;

            if (System.IO.File.Exists(this.xmlFilePath))
            {
                ds = (DataTagSetting)DataTagSetting.Deserialize(this.xmlFilePath);
            }
            else {
                ds = null;
                msg = this.xmlFilePath + "\n" + AppResource.GetString("ERROR_TAG_SETTING_DATATAG_FILE_NOT_FOUND");
                ShowErrorMessage(msg); }

            ct = new ConstantSetting();
            if (System.IO.File.Exists(this.xmlFilePathConstant))
            {
                ct = SettingBase.DeserializeFromXml<ConstantSetting>(this.xmlFilePathConstant);
            }
            else {
                ct = null;
                msg = this.xmlFilePathConstant + "\n" + AppResource.GetString("ERROR_TAG_SETTING_CONSTANT_FILE_NOT_FOUND");
                ShowErrorMessage(msg); }
        }
Esempio n. 4
0
 public CalcDataManager(DataTagSetting src_DataTagSetting, ConstantSetting src_ConstantSetting, TagChannelRelationSetting src_TagChannelRelationSetting, MeasureSetting src_MeasureSetting)
 {
     dataTagSetting = src_DataTagSetting;
     constantSetting = src_ConstantSetting;
     tagChannelRelationSetting = src_TagChannelRelationSetting;
     measureSetting = src_MeasureSetting;
 }
Esempio n. 5
0
        /// <summary>
        /// form open
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmTagSetting_Load(object sender, EventArgs e)
        {
            cboTagKind.DataSource = dtKind;
            if (dtKind.Rows.Count > 0)
            {
                cboTagKind.SelectedIndex = 0;
            }
            if (this.IsMeasure)
            { this.dataTagSetting = SystemSetting.DataTagSetting; }
            else
            { this.dataTagSetting = AnalyzeData.DataTagSetting; }
            if (this.dataTagSetting != null)
            {
                dgvTagList.Rows.Clear();
                if (this.dataTagSetting != null && this.dataTagSetting.DataTagList != null)
                {
                    this.list.AddRange(this.dataTagSetting.DataTagList);
                    int count = this.dataTagSetting.DataTagList.Length;
                    count = count > 300 ? 300 : count;
                    for (int i = 0; i < count; i++)
                    {
                        if (this.dataTagSetting.DataTagList[i] != null)
                        {
                            dgvTagList.Rows.Add(new object[] { this.dataTagSetting.DataTagList[i].TagNo, this.dataTagSetting.DataTagList[i].GetSystemTagName(), this.dataTagSetting.DataTagList[i].GetSystemUnit() });
                        }
                        else
                        {
                            dgvTagList.Rows.Add(new object[] { "---", "---", "---" });
                        }
                    }
                    if (count > 0)
                    {
                        ShowInfo(this.dataTagSetting.DataTagList[0]);
                    }
                }
            }
            else { ShowErrorMessage(AppResource.GetString("ERROR_TAG_SETTING_DATATAG_FILE_NOT_FOUND")); }
            this.constantSetting = new ConstantSetting();
            if (this.IsMeasure)
            {
                if (SystemSetting.ConstantSetting != null)
                { this.constantSetting = SystemSetting.ConstantSetting; }
                else { ShowErrorMessage(AppResource.GetString("ERROR_TAG_SETTING_CONSTANT_FILE_NOT_FOUND")); }
            }
            else
            { this.constantSetting = AnalyzeData.ConstantSetting; }
            this.dirtyFlag = false;

            PutLog("start frmTagSetting");
            if (!IsMeasure)
            {
                if (dgvTagList.RowCount > 0)
                {
                    for (int i = 0; i < dgvTagList.RowCount; i++)
                    {
                        if (this.dataTagSetting.DataTagList[i].TagKind == 0 && !this.dataTagSetting.DataTagList[i].IsBlank)
                        {
                            dgvTagList.Rows[i].ReadOnly = true;
                            dgvTagList.Rows[i].DefaultCellStyle.BackColor = Color.Gray;
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// load settings from xml files
        /// </summary>
        public static void LoadInstance()
        {
            MeasureSetting = new MeasureSetting();
            string xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + MeasureSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                MeasureSetting = (MeasureSetting)MeasureSetting.Deserialize(xmlFilePath);
                if (MeasureSetting.Mode1_MeasCondition != null)
                {
                    MeasureSetting.Mode1_MeasCondition.IsUpdated = false;
                }
            }
            else
            {
                MeasureSetting = new MeasureSetting() { FilePath = xmlFilePath };
            }

            ChannelsSetting = new ChannelsSetting();
            xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + ChannelsSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                ChannelsSetting = (ChannelsSetting)ChannelsSetting.Deserialize(xmlFilePath);
            }
            else
            {
                ChannelsSetting = new ChannelsSetting() { FilePath = xmlFilePath };
            }

            ConstantSetting = new ConstantSetting();
            xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + ConstantSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                ConstantSetting = (ConstantSetting)ConstantSetting.Deserialize(xmlFilePath);
            }
            else
            {
                ConstantSetting = new ConstantSetting() { FilePath = xmlFilePath };
            }

            DataTagSetting = new DataTagSetting();
            xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + DataTagSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                DataTagSetting = (DataTagSetting)DataTagSetting.Deserialize(xmlFilePath);
            }
            else
            {
                DataTagSetting = new DataTagSetting() { FilePath = xmlFilePath };
            }

            RelationSetting = new TagChannelRelationSetting();
            xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + TagChannelRelationSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                RelationSetting = (TagChannelRelationSetting)TagChannelRelationSetting.Deserialize(xmlFilePath);
            }
            else
            {
                RelationSetting = new TagChannelRelationSetting() { FilePath = xmlFilePath };
            }

            PositionSetting = new SensorPositionSetting();
            xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + SensorPositionSetting.FileName;
            if (System.IO.File.Exists(xmlFilePath))
            {
                PositionSetting = (SensorPositionSetting)SensorPositionSetting.Deserialize(xmlFilePath);
            }
            else
            {
                PositionSetting = new SensorPositionSetting() { FilePath = xmlFilePath };
            }

            SystemConfig = new SystemConfig();
            SystemConfig.LoadXmlFile();

            HardInfoStruct = new HardInfoStruct();
            HardInfoStruct.LoadXmlFile();
        }
Esempio n. 7
0
        /// <summary>
        /// form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmTagSettingConstant_Load(object sender, EventArgs e)
        {
            int count = 0;
            try
            {
                if(SystemSetting.ConstantSetting != null)
                {
                    this.setting = SystemSetting.ConstantSetting;
                    dgvConstant.Rows.Clear();
                    if (this.setting != null && this.setting.ConstantList != null)
                    {
                        count = this.setting.ConstantList.Length > ConstantSetting.MaxArraySize ? ConstantSetting.MaxArraySize : this.setting.ConstantList.Length;
                        for (int i = 0; i < count; i++)
                        {
                            if (this.setting.ConstantList[i] != null)
                            {
                                dgvConstant.Rows.Add(new string[] { (i + 1).ToString(), this.setting.ConstantList[i].GetSystemConstantName(), this.setting.ConstantList[i].Value.ToString() });
                                this.list.Add(this.setting.ConstantList[i]);
                            }
                        }
                        this.currentData = this.list[0];
                    }
                    if (Mode == CONSTANTMODE.Update)
                    {
                        btnSelect.Text = "TXT_UPDATE";
                        for (int j = 0; j < count; j++)
                        {
                            dgvConstant.Rows[j].Cells[2].ReadOnly = false;
                        }
                    }
                }

                AppResource.SetControlsText(this);
                this.dirtyFlag = false;
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
        }