MakeNewObject() public method

Member MakeNewObject
public MakeNewObject ( int clid, int hvoOwner, int tag, int ord ) : int
clid int clid
hvoOwner int hvoOwner
tag int tag
ord int ord
return int
Ejemplo n.º 1
0
		public override void FixtureSetup()
		{
			base.FixtureSetup();

			SetupTestModel(Resources.TextCacheModel_xml);

			m_sda = new RealDataCache();
			m_sda.MetaDataCache = MetaDataCache.CreateMetaDataCache("TestModel.xml");
			//m_cache.ParaContentsFlid = kflidParaContents;
			//m_cache.ParaPropertiesFlid = kflidParaProperties;
			//m_cache.TextParagraphsFlid = kflidTextParas;

			Debug.Assert(m_wsManager == null);
			m_wsManager = Cache.ServiceLocator.GetInstance<IWritingSystemManager>();
			m_sda.WritingSystemFactory = m_wsManager;

			m_wsAnal = Cache.DefaultAnalWs;

			m_wsVern = Cache.DefaultVernWs;

			//IWritingSystem deWs;
			//m_wsManager.GetOrSet("de", out deWs);
			//m_wsDeu = deWs.Handle;

			//m_wsManager.UserWs = m_wsEng;
			//m_wsUser = m_wsManager.UserWs;

			m_tsf = TsStrFactoryClass.Create();

			m_hvoLexDb = m_sda.MakeNewObject(kclsidLexDb, 0, -1, -1);

			kflidLexDb_Entries = m_sda.MetaDataCache.GetFieldId("LexDb", "Entries", false);
			kflidEntry_Form = m_sda.MetaDataCache.GetFieldId("Entry", "Form", false);
			kflidEntry_Summary = m_sda.MetaDataCache.GetFieldId("Entry", "Summary", false);

			m_hvoKick = m_sda.MakeNewObject(kclsidEntry, m_hvoLexDb, kflidLexDb_Entries, 0);
			m_sda.SetMultiStringAlt(m_hvoKick, kflidEntry_Form, m_wsVern, m_tsf.MakeString("kick", m_wsVern));
			m_sda.SetString(m_hvoKick, kflidEntry_Summary, m_tsf.MakeString("strike with foot", m_wsAnal));

			var keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["layout"] = new[] { "class", "type", "name", "choiceGuid" };
			keyAttrs["group"] = new[] { "label" };
			keyAttrs["part"] = new[] { "ref" };
			var layoutInventory = new Inventory("*.fwlayout", "/LayoutInventory/*", keyAttrs, "test", "nowhere");
			layoutInventory.LoadElements(Resources.Layouts_xml, 1);

			keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["part"] = new[] { "id" };

			var partInventory = new Inventory("*Parts.xml", "/PartInventory/bin/*", keyAttrs, "test", "nowhere");
			partInventory.LoadElements(Resources.Parts_xml, 1);

			m_layouts = new LayoutCache(m_sda.MetaDataCache, layoutInventory, partInventory);
		}
		protected SimpleRootSiteDataProviderViewBase(RealDataCache rdc)
		{
			Cache = rdc;
			VwCache = rdc;
			m_hvoRoot = Cache.MakeNewObject(kclsidOwnerless, 0, -1, -1);
		}