SIL.FieldWorks.Common.Framework.DetailControls.GhostStringSlice.GhostStringSliceView.GhostStringSliceView C# (CSharp) Méthode

GhostStringSliceView() public méthode

public GhostStringSliceView ( int hvo, int flid, XmlNode nodeObjProp, SIL.FieldWorks.FDO.FdoCache cache ) : System
hvo int
flid int
nodeObjProp System.Xml.XmlNode
cache SIL.FieldWorks.FDO.FdoCache
Résultat System
			public GhostStringSliceView(int hvo, int flid, XmlNode nodeObjProp, FdoCache cache)
			{
				Cache = cache;
				m_hvoObj = hvo;
				m_flidEmptyProp = flid;
				m_nodeObjProp = nodeObjProp;

				// Figure the type of object we are pretending to be.
				string dstClass = XmlUtils.GetOptionalAttributeValue(nodeObjProp, "ghostClass");
				if (dstClass == null)
					m_clidDst = cache.DomainDataByFlid.MetaDataCache.GetDstClsId((int)flid);
				else
					m_clidDst = cache.DomainDataByFlid.MetaDataCache.GetClassId(dstClass);

				// And the one property of that imaginary object we are displaying.
				string stringProp = XmlUtils.GetManditoryAttributeValue(nodeObjProp, "ghost");
				// Special case for making a Text
				if (m_flidEmptyProp == RnGenericRecTags.kflidText)
				{
					m_flidStringProp = StTxtParaTags.kflidContents;
				}
				else
				{
					m_flidStringProp = cache.DomainDataByFlid.MetaDataCache.GetFieldId2(m_clidDst, stringProp, true);
				}

				// And what writing system should typing in the field employ?
				IWritingSystemContainer wsContainer = cache.ServiceLocator.WritingSystems;
				string stringWs = XmlUtils.GetManditoryAttributeValue(nodeObjProp, "ghostWs");
				switch (stringWs)
				{
					case "vernacular":
						m_wsToCreate = wsContainer.DefaultVernacularWritingSystem.Handle;
						break;

					case "analysis":
						m_wsToCreate = wsContainer.DefaultAnalysisWritingSystem.Handle;
						break;

					case "pronunciation":
						// Pronunciation isn't always defined.  Fall back to vernacular.
						if (wsContainer.DefaultPronunciationWritingSystem == null)
							m_wsToCreate = wsContainer.DefaultVernacularWritingSystem.Handle;
						else
							m_wsToCreate = wsContainer.DefaultPronunciationWritingSystem.Handle;
						break;

					default:
						throw new Exception("ghostWs must be vernacular or analysis or pronunciation");
				}
			}