public void ModifyVectors(LangProject lp) { //add a new item to an owned sequence attribute CmAnthroItem a = (CmAnthroItem)lp.AnthroListOA.PossibilitiesOS.Append(new CmAnthroItem()); //add a new item to an owned collection attribute CmOverlay overlay = (CmOverlay)lp.OverlaysOC.Add(new CmOverlay()); //add a new item to a reference collection attribute CmPossibility position = (CmPossibility)lp.PositionsOA.PossibilitiesOS [0]; CmPerson person = (CmPerson)lp.PeopleOA.PossibilitiesOS[0]; person.PositionsRC.Add(position); //move the last item in a sequence to the beginning FdoOwnSeqVector positions = lp.PositionsOA.PossibilitiesOS; position = (CmPossibility)positions[positions.Count - 1]; positions.InsertAt(position, 0); //do the same, without instantiating the object we're moving int hvo = positions.hvoArray[positions.Count - 1]; positions.InsertAt(hvo, 0); }
public void ReadFromVectors(LangProject lp) { //read a single item, the third element in the AnthroList CmAnthroItem p = (CmAnthroItem)lp.AnthroListOA.PossibilitiesOS[2]; //read all of the items in the AntrhoList foreach (CmAnthroItem item in lp.AnthroListOA.PossibilitiesOS) { Console.WriteLine(item.Name.AnalysisDefaultWritingSystem); } }
public void SetGetMultiTsString() { CheckDisposed(); CmAnthroItem p = new CmAnthroItem(); Cache.LangProject.AnthroListOA.PossibilitiesOS.Append(p); // TEST WRITE p.Description.AnalysisDefaultWritingSystem.Text = "analysis description"; // TEST READ Assert.AreEqual("analysis description", p.Description.AnalysisDefaultWritingSystem.Text); }
public void GetProperties() { CheckDisposed(); // Putting AnthroItems in the UsageTypes doesn't really make sense, but for testing purposes // it doesn't matter what we store there as long as it is derived from CmPossibility CmAnthroItem p = new CmAnthroItem(); Cache.LangProject.LexDbOA.UsageTypesOA.PossibilitiesOS.Append(p); Cache.MainCacheAccessor.SetInt(p.Hvo, (int)CmPossibility.CmPossibilityTags.kflidBackColor, 0xffc000); Assert.AreEqual(0xffc000, p.BackColor); }
ICmAnthroItem ICmAnthroItemFactory.Create(Guid guid, ICmAnthroItem owner) { if (owner == null) throw new ArgumentNullException("owner"); int hvo = ((IDataReader)m_cache.ServiceLocator.GetInstance<IDataSetup>()).GetNextRealHvo(); int flid = m_cache.MetaDataCache.GetFieldId("CmPossibility", "SubPossibilities", false); var retval = new CmAnthroItem(m_cache, hvo, guid); owner.SubPossibilitiesOS.Add(retval); return retval; }