/// <summary>
        /// Overridden to set the new values selected from the chooser dialog.
        /// </summary>
        /// <param name="rghvosChosen"></param>
        public override void SetItems(List <int> rghvosChosen)
        {
            CheckDisposed();
            // null indicates that we cancelled out of the chooser dialog -- we shouldn't get
            // here with that value, but just in case...
            if (rghvosChosen == null)
            {
                return;
            }
            int h1        = m_vectorRefView.RootBox.Height;
            int citemsOld = m_cache.GetVectorSize(m_obj.Hvo, m_flid);
            // Find out whether we're adding or deleting items.
            bool fChange = false;

            if (citemsOld != rghvosChosen.Count)
            {
                fChange = true;
            }
            else if (citemsOld > 0)
            {
                int[] hvosOld = m_cache.GetVectorProperty(m_obj.Hvo, m_flid, false);
                Debug.Assert(citemsOld == hvosOld.Length);
                // First check whether we're deleting any items (that data is already in place).
                for (int i = 0; i < hvosOld.Length; ++i)
                {
                    if (!rghvosChosen.Contains(hvosOld[i]))
                    {
                        fChange = true;
                        break;
                    }
                }
                if (!fChange)
                {
                    // Nothing was deleted, now check whether anything was added.
                    List <int> rghvosOld = new List <int>();
                    for (int i = 0; i < citemsOld; ++i)
                    {
                        rghvosOld.Add(hvosOld[i]);
                    }
                    for (int i = 0; i < rghvosChosen.Count; ++i)
                    {
                        if (!rghvosOld.Contains(rghvosChosen[i]))
                        {
                            fChange = true;
                            break;
                        }
                    }
                }
            }
            if (fChange)
            {
                ResetProperty(DetailControlsStrings.ksSetItem, rghvosChosen.ToArray());
                m_vectorRefView.ReloadVector();
                int h2 = m_vectorRefView.RootBox.Height;
                CheckViewSizeChanged(h1, h2);
            }
        }
示例#2
0
 public override void UpdateDisplayFromDatabase()
 {
     m_vectorRefView.ReloadVector();
 }