Пример #1
0
        private void CreateVirtualProperties()
        {
            m_virtualName = m_fieldName + "_" + "TypeAhead";
            IVwCacheDa        cda = m_sda as IVwCacheDa;
            IVwVirtualHandler vh  = cda.GetVirtualHandlerName(m_className, m_virtualName);

            if (vh == null)
            {
                // Need to create virtual property.
                switch (m_type)
                {
                case (int)CellarModuleDefns.kcptReferenceAtom:
                    vh           = new TypeAheadAtomVh(m_tag);
                    vh.ClassName = m_className;
                    vh.FieldName = m_virtualName;
                    vh.Type      = m_type;
                    cda.InstallVirtual(vh);
                    break;

                case (int)CellarModuleDefns.kcptReferenceSequence:
                case (int)CellarModuleDefns.kcptReferenceCollection:
                    vh           = new TypeAheadSeqVh(m_tag);
                    vh.ClassName = m_className;
                    vh.FieldName = m_virtualName;
                    vh.Type      = (int)CellarModuleDefns.kcptReferenceSequence;
                    cda.InstallVirtual(vh);
                    break;

                default:
                    throw new Exception("unsupported property type for type-ahead chooser");
                }
            }
            m_virtualTagObj = vh.Tag;

            // Make the virtual handler for type-ahead names if it doesn't already exist.
            vh = cda.GetVirtualHandlerName("CmObject", kstrTaName);
            if (vh == null)
            {
                vh           = new TypeAheadShortNameStringVh(m_cache);
                vh.ClassName = m_className;
                vh.FieldName = kstrTaName;
                vh.Type      = (int)CellarModuleDefns.kcptString;
                cda.InstallVirtual(vh);
            }
            m_taTagName = vh.Tag;
            // And the general-purpose Shortname one.
            vh = cda.GetVirtualHandlerName("CmObject", kstrSnName);
            if (vh == null)
            {
                vh           = new TypeAheadShortNameStringVh(m_cache);
                vh.ClassName = m_className;
                vh.FieldName = kstrSnName;
                vh.Type      = (int)CellarModuleDefns.kcptString;
                cda.InstallVirtual(vh);
            }
            m_snTagName = vh.Tag;
        }
Пример #2
0
		private void CreateVirtualProperties()
		{
			m_virtualName = m_fieldName + "_" + "TypeAhead";
			IVwCacheDa cda = m_sda as IVwCacheDa;
			IVwVirtualHandler vh = cda.GetVirtualHandlerName(m_className, m_virtualName);
			if (vh == null)
			{
				// Need to create virtual property.
				switch (m_type)
				{
				case (int)CellarModuleDefns.kcptReferenceAtom:
					vh = new TypeAheadAtomVh(m_tag);
					vh.ClassName = m_className;
					vh.FieldName = m_virtualName;
					vh.Type = m_type;
					cda.InstallVirtual(vh);
					break;
				case (int) CellarModuleDefns.kcptReferenceSequence:
				case (int) CellarModuleDefns.kcptReferenceCollection:
					vh = new TypeAheadSeqVh(m_tag);
					vh.ClassName = m_className;
					vh.FieldName = m_virtualName;
					vh.Type = (int) CellarModuleDefns.kcptReferenceSequence;
					cda.InstallVirtual(vh);
					break;
				default:
					throw new Exception("unsupported property type for type-ahead chooser");
				}
			}
			m_virtualTagObj = vh.Tag;

			// Make the virtual handler for type-ahead names if it doesn't already exist.
			vh = cda.GetVirtualHandlerName("CmObject", kstrTaName);
			if (vh == null)
			{
				vh = new TypeAheadShortNameStringVh(m_cache);
				vh.ClassName = m_className;
				vh.FieldName = kstrTaName;
				vh.Type = (int)CellarModuleDefns.kcptString;
				cda.InstallVirtual(vh);
			}
			m_taTagName = vh.Tag;
			// And the general-purpose Shortname one.
			vh = cda.GetVirtualHandlerName("CmObject", kstrSnName);
			if (vh == null)
			{
				vh = new TypeAheadShortNameStringVh(m_cache);
				vh.ClassName = m_className;
				vh.FieldName = kstrSnName;
				vh.Type = (int)CellarModuleDefns.kcptString;
				cda.InstallVirtual(vh);
			}
			m_snTagName = vh.Tag;
		}