Ejemplo n.º 1
0
        private void UpdateActionListEx(bool bRestoreSelected)
        {
            object[] vSelected = (bRestoreSelected ?
                                  UIUtil.GetSelectedItemTags(m_lvActions) : null);
            UIScrollInfo      s         = UIUtil.GetScrollInfo(m_lvActions, true);
            List <EcasAction> lToRemove = new List <EcasAction>();

            m_lvActions.BeginUpdate();
            m_lvActions.Items.Clear();
            foreach (EcasAction a in m_trigger.ActionCollection)
            {
                EcasActionType t = Program.EcasPool.FindAction(a.Type);
                if (t == null)
                {
                    Debug.Assert(false); lToRemove.Add(a); continue;
                }

                ListViewItem lvi = m_lvActions.Items.Add(t.Name);
                lvi.SubItems.Add(EcasUtil.ParametersToString(a, t.Parameters));
                lvi.Tag        = a;
                lvi.ImageIndex = (int)t.Icon;
            }

            foreach (EcasAction a in lToRemove)
            {
                m_trigger.ActionCollection.Remove(a);
            }
            if (vSelected != null)
            {
                UIUtil.SelectItems(m_lvActions, vSelected);
            }

            UIUtil.Scroll(m_lvActions, s, true);
            m_lvActions.EndUpdate();
        }
Ejemplo n.º 2
0
        private void UpdateActionListEx(bool bRestoreSelected)
        {
            object[] vSelected = (bRestoreSelected ?
                                  UIUtil.GetSelectedItemTags(m_lvActions) : null);

            m_lvActions.Items.Clear();
            foreach (EcasAction a in m_trigger.ActionCollection)
            {
                EcasActionType t   = Program.EcasPool.FindAction(a.Type);
                ListViewItem   lvi = m_lvActions.Items.Add(t.Name);
                lvi.SubItems.Add(EcasUtil.ParametersToString(a, t.Parameters));
                lvi.Tag        = a;
                lvi.ImageIndex = (int)t.Icon;
            }

            if (vSelected != null)
            {
                UIUtil.SelectItems(m_lvActions, vSelected);
            }
        }