Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Keys the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="fForSorting">if set to <c>true</c> [f for sorting].</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public ITsString Key(IManyOnePathSortItem item, bool fForSorting)
        {
            if (m_cache == null)
            {
                throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state.");
            }
            int hvo = item.RootObjectHvo;
            TsStringCollectorEnv collector;

            if (fForSorting)
            {
                collector = new SortCollectorEnv(null, m_sda, hvo);
            }
            else
            {
                collector = new TsStringCollectorEnv(null, m_sda, hvo);
            }

            // This will check to see if the VC is either null or disposed.  The disposed check is neccesary because
            // there are several instances where we can have a reference to an instance that was disposed, which will
            // cause problems later on.
            // Enhance CurtisH/EricP: If this VC gets used in other places, rather than adding more checks like this one,
            // it may be better to refactor XWorksViewBase to cause it to reload the sorter and filter from persistence
            // every time the tool is changed
            if (m_vc == null)
            {
                m_vc = new XmlBrowseViewBaseVc(m_cache, m_stringTbl);
                m_vc.SuppressPictures = true;                 // we won't dispose of it, so it mustn't make pictures (which we don't need)
                m_vc.DataAccess       = m_sda;
            }
            else
            {
                if (m_vc.Cache == null)
                {
                    m_vc.Cache = m_cache;
                }
                if (m_vc.Cache == null)
                {
                    throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state.");
                }
                if (m_vc.StringTbl == null)
                {
                    m_vc.StringTbl = m_stringTbl;
                }
            }
            m_vc.DisplayCell(item, m_colSpec, hvo, collector);
            return(collector.Result);
        }
Ejemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Keys the specified item.
		/// </summary>
		/// <param name="item">The item.</param>
		/// <param name="fForSorting">if set to <c>true</c> [f for sorting].</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public ITsString Key(ManyOnePathSortItem item, bool fForSorting)
		{
			CheckDisposed();

			if (m_cache == null)
				throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state.");
			int hvo = item.RootObject.Hvo;
			TsStringCollectorEnv collector;
			if (fForSorting)
			{
				collector = new SortCollectorEnv(null, m_cache.MainCacheAccessor, hvo);
			}
			else
			{
				collector = new TsStringCollectorEnv(null, m_cache.MainCacheAccessor, hvo);
			}

			// This will check to see if the VC is either null or disposed.  The disposed check is neccesary because
			// there are several instances where we can have a reference to an instance that was disposed, which will
			// cause problems later on.
			// Enhance CurtisH/EricP: If this VC gets used in other places, rather than adding more checks like this one,
			// it may be better to refactor XWorksViewBase to cause it to reload the sorter and filter from persistence
			// every time the tool is changed
			if (m_vc == null || m_vc.IsDisposed)
			{
				m_vc = new XmlBrowseViewBaseVc(m_cache, m_stringTbl);
			}
			else
			{
				if (m_vc.Cache == null)
					m_vc.Cache = m_cache;
				if (m_vc.Cache == null)
					throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state.");
				if (m_vc.StringTbl == null)
					m_vc.StringTbl = m_stringTbl;
			}
			m_vc.DisplayCell(item, m_colSpec, hvo, collector);
			return collector.Result;
		}