Beispiel #1
0
        public void RefreshFilterList()
        {
            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            //Read the filter list in from TSX -- maximum 24 for no good reason
            //the section will be SU-Filter,
            //the entry name will be the filter name
            //the entry will be the filter index
            //
            //For initalization, if the filter is already configured, then
            //  it is assumed active and the index will be set.
            //if the filter is not there then the filter will not be added to the list.
            //
            //

            //Generate a list of filters from tsx, in index order
            List <string> fwlist = TSXLink.FilterWheel.FilterWheelList();

            if (fwlist == null)
            {
                return;
            }
            List <Filter> tsxFilterList = new List <Filter>();

            if (fwlist.Count > 0)
            {
                for (int filterIndex = 0; filterIndex < fwlist.Count(); filterIndex++)
                {
                    tsxFilterList.Add(new Filter(fwlist[filterIndex], filterIndex, 1));
                }
                //Clear the current filter list box
                FilterListBox.Items.Clear();
                //For each filter from tsx, add it to the list, and set it checked, if it is also in the configuration file
                foreach (Filter tsxFilter in tsxFilterList)
                {
                    if (!tsxFilter.Name.StartsWith("Filter") && !(tsxFilter.Name == ""))  //weed out unnamed filter entries
                    {
                        //check the target plan this filter name, if found, then add the filter to the box and check it
                        if (tPlan.CheckFilter(tsxFilter))
                        {
                            FilterListBox.Items.Add(tsxFilter.Name.Replace(" ", "") + "-" + tsxFilter.Index, true);
                        }
                        else
                        {
                            FilterListBox.Items.Add(tsxFilter.Name.Replace(" ", "") + "-" + tsxFilter.Index, false);
                        }
                    }
                }
            }
        }