Exemplo n.º 1
0
        public void LoadListTrend(string trendListFile)
        {
            using (IniFile iniFile = new IniFile(trendListFile)) {
                for (int k = 1; k <= MAX_TRENDS; k++)
                {
                    TrendChart1[k - 1].Tag = iniFile.ReadString("Trends", "Trend" + Convert.ToString(k), "");
                }

                for (int i = 0; i < MAX_TRENDS; i++)
                {
                    TrendObj trendObj = TrendChart1[i];

                    if (!string.IsNullOrEmpty(trendObj.Tag))
                    {
                        ListViewItem listItem = PIBUtils.FindCaption(lvTags, trendObj.Tag);
                        if (listItem != null)
                        {
                            listItem.Checked = true;
                            SetTagByItem(trendObj, listItem);
                            trendObj.PostAction = (PostAction)iniFile.ReadInteger("Trends", "PostAction" + Convert.ToString(i), 1);
                            if (trendObj.PostAction != PostAction.paNone)
                            {
                                FilterOptions filter = trendObj.Filter;
                                filter.Mode                    = (FilterMode)iniFile.ReadInteger("Trends", "Mode" + Convert.ToString(i), 1);
                                filter.BandWidth               = iniFile.ReadFloat("Trends", "BandWidth" + Convert.ToString(i), 0.1);
                                filter.Overshoot               = iniFile.ReadBool("Trends", "Overshoot" + Convert.ToString(i), false);
                                filter.FrequencyResolution     = iniFile.ReadInteger("Trends", "FrequencyResolution" + Convert.ToString(i), 5);
                                filter.SuppressionDegree       = (FilterDegree)iniFile.ReadInteger("Trends", "SuppressionDegree" + Convert.ToString(i), 0);
                                filter.SubstractionNoiseDegree = (FilterDegree)iniFile.ReadInteger("Trends", "SubstractionNoiseDegree" + Convert.ToString(i), 0);
                            }
                        }
                        else
                        {
                            PIBUtils.ShowWarning("Tag " + trendObj.Tag + " not exists");
                            trendObj.Tag = "";
                            fModified    = true;
                        }
                    }
                }

                TrendChart1.FiltersApply();
                SelectTag(TrendChart1[0].Tag);
                LVTagsClick(lvTags, null);
            }

            CaptionTagList = "Current list of tags: " + Path.GetFileName(trendListFile);
        }