Example #1
0
        public void LoadData()
        {
            // Get the language project as an FDO object
            ILangProject lp = m_fdoCache.LangProject;

            // Use it to get the HVO of the data notebook, but without making an FDO object
            // and thus loading data.
            Assert.IsTrue(m_sda.get_IsPropInCache(lp.Hvo,
                                                  (int)LangProject.LangProjectTags.kflidResearchNotebook,
                                                  (int)CellarModuleDefns.kcptOwningAtom, 0),
                          "LP notebook loaded by FDO");
            int hvoNotebook = m_fdoCache.GetObjProperty(lp.Hvo,
                                                        (int)LangProject.LangProjectTags.kflidResearchNotebook);

            Assert.IsFalse(m_sda.get_IsPropInCache(hvoNotebook,
                                                   (int)RnResearchNbk.RnResearchNbkTags.kflidRecords,
                                                   (int)CellarModuleDefns.kcptOwningCollection, 0),
                           "Nb records not loaded");
            // Do a simple pre-load to get the records.
            IVwDataSpec dts = VwDataSpecClass.Create();

            // Request loading the title of each record. (Note that currently we must make
            // an entry for each concrete class; making one for the base class does not work.)
            dts.AddField(RnAnalysis.kClassId,
                         (int)RnGenericRec.RnGenericRecTags.kflidTitle,
                         FldType.kftString,
                         m_fdoCache.LanguageWritingSystemFactoryAccessor,
                         0);
            dts.AddField(RnEvent.kClassId,
                         (int)RnGenericRec.RnGenericRecTags.kflidTitle,
                         FldType.kftString,
                         m_fdoCache.LanguageWritingSystemFactoryAccessor,
                         0);
            int[] clsids = new int[1];
            clsids[0] = RnResearchNbk.kClassId;
            int[] hvos = new int[1];
            hvos[0] = hvoNotebook;
            m_da.LoadData(hvos, clsids, hvos.Length, dts, null, true);
            Assert.IsTrue(m_sda.get_IsPropInCache(hvoNotebook,
                                                  (int)RnResearchNbk.RnResearchNbkTags.kflidRecords,
                                                  (int)CellarModuleDefns.kcptOwningCollection, 0),
                          "Nb records are loaded");
            int chvoRecs = m_sda.get_VecSize(hvoNotebook,
                                             (int)RnResearchNbk.RnResearchNbkTags.kflidRecords);

            // Be careful what we assert...don't want it too dependent on the exact data.
            // Should be OK to assume at least a few records.
            Assert.IsTrue(chvoRecs > 4, "at least 4 recs");
            int hvoRec3 = m_sda.get_VecItem(hvoNotebook,
                                            (int)RnResearchNbk.RnResearchNbkTags.kflidRecords, 3);

            Assert.IsTrue(m_sda.get_IsPropInCache(hvoRec3,
                                                  (int)RnGenericRec.RnGenericRecTags.kflidTitle,
                                                  (int)CellarModuleDefns.kcptString, 0),
                          "Got title of rec 3");
            ITsString qtssRec3Title = m_sda.get_StringProp(hvoRec3,
                                                           (int)RnGenericRec.RnGenericRecTags.kflidTitle);
            // Now get the info through FDO
            ICmObject objRec3 = CmObject.CreateFromDBObject(m_fdoCache, hvoRec3);

            Assert.IsTrue(objRec3 is IRnGenericRec, "object of correct type");
            IRnGenericRec grRec3 = (IRnGenericRec)objRec3;

            // I'd prefer to use full ITsString equality test, but not sure how to get
            // a regular ITsString from FDO obj.
            Assert.AreEqual(qtssRec3Title.Text, grRec3.Title.Text,
                            "two ways to retrieve R3 title match");
        }
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="_rghvo"></param>
		/// <param name="_rgclsid"></param>
		/// <param name="chvo"></param>
		/// <param name="_dts"></param>
		/// <param name="_advi"></param>
		/// <param name="fIncludeOwnedObjects"></param>
		/// ------------------------------------------------------------------------------------
		public void LoadData(int[] _rghvo, int[] _rgclsid, int chvo, IVwDataSpec _dts, IAdvInd _advi, bool fIncludeOwnedObjects)
		{
			CheckDisposed();
			throw new NotImplementedException();
		}