コード例 #1
0
        public void Initialize(Document doc, IItemBaseFilter filter, ItemBase initiallySelectedItem)
        {
            Items.Clear();
            try
            {
                int index = 0, iSelected = -1;
                foreach (ItemBase itemBase in doc.TypeList)
                {
                    if (null == filter || filter.Accept(this, itemBase))
                    {
                        Items.Add(new ItemBaseWrapper(itemBase));
                        if (initiallySelectedItem == itemBase)
                        {
                            iSelected = index;
                        }
                        ++index;
                    }
                }

                Analysis analysisInitial = null;
                if (null != initiallySelectedItem)
                {
                    if (initiallySelectedItem is PackableLoaded packableLoadedInitial)
                    {
                        analysisInitial = packableLoadedInitial.ParentAnalysis;
                    }
                }

                foreach (Analysis analysis in doc.Analyses)
                {
                    PackableLoaded eqvtPackable = analysis.EquivalentPackable;
                    if (null == eqvtPackable)
                    {
                        continue;
                    }
                    if (null == filter || filter.Accept(this, eqvtPackable))
                    {
                        Items.Add(new ItemBaseWrapper(eqvtPackable));
                        if (analysisInitial == analysis)
                        {
                            iSelected = index;
                        }
                        ++index;
                    }
                }
                if (-1 == iSelected && Items.Count > 0)
                {
                    SelectedIndex = 0;
                }
                else
                {
                    SelectedIndex = iSelected;
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
コード例 #2
0
        public void Initialize(Document doc, IItemBaseFilter filter, ItemBase initialSelect)
        {
            Items.Clear();
            int index = 0, iSelected = -1;

            foreach (ItemBase itemBase in doc.TypeList)
            {
                if (null == filter || filter.Accept(this, itemBase))
                {
                    Items.Add(new ItemBaseWrapper(itemBase));
                    if (initialSelect == itemBase)
                    {
                        iSelected = index;
                    }
                    ++index;
                }
            }
            if (-1 == iSelected && Items.Count > 0)
            {
                SelectedIndex = 0;
            }
            else
            {
                SelectedIndex = iSelected;
            }
        }
コード例 #3
0
        public void Initialize(Document doc, IItemBaseFilter filter, ItemBase initialSelect)
        {
            Items.Clear();
            int index = 0, iSelected = -1;

            foreach (ItemBase itemBase in doc.TypeList)
            {
                if (null == filter || filter.Accept(this, itemBase))
                {
                    Items.Add(new ItemBaseWrapper(itemBase));
                    if (initialSelect == itemBase)
                    {
                        iSelected = index;
                    }
                    ++index;
                }
            }
            foreach (Analysis analysis in doc.Analyses)
            {
                PackableLoaded eqvtPackable = analysis.EquivalentPackable;
                if (null == eqvtPackable)
                {
                    continue;
                }
                if (null == filter || filter.Accept(this, eqvtPackable))
                {
                    Items.Add(new ItemBaseWrapper(eqvtPackable));
                    if (initialSelect == analysis)
                    {
                        iSelected = index;
                    }
                    ++index;
                }
            }
            if (-1 == iSelected && Items.Count > 0)
            {
                SelectedIndex = 0;
            }
            else
            {
                SelectedIndex = iSelected;
            }
        }