当前位置: 首页>>代码示例>>C#>>正文


C# FdoCache.PropChanged方法代码示例

本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.PropChanged方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.PropChanged方法的具体用法?C# FdoCache.PropChanged怎么用?C# FdoCache.PropChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SIL.FieldWorks.FDO.FdoCache的用法示例。


在下文中一共展示了FdoCache.PropChanged方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RDENewSense


//.........这里部分代码省略.........
			Debug.Assert(rgtss.Length == columns.Count);

			// Make a new sense in a new entry.
			ILexEntry le = cache.LangProject.LexDbOA.EntriesOC.Add(
				new LexEntry());
			IMoForm morph = null;

			// create a LexSense that has the given definition and semantic domain
			// Needs to be LexSense, since later calls use non-interface methods.
			LexSense ls = (LexSense)le.SensesOS.Append(new LexSense());

			ILgWritingSystemFactory wsf = cache.LanguageWritingSystemFactoryAccessor;
			// go through each column and store the appropriate information.
			for (int i = 0; i < columns.Count; ++i)
			{
				// Review: Currently we key off the column labels to determine which columns
				// correspond to CitationForm and which correspond to Definition.
				// Ideally we'd like to get at the flids used to build the column display strings.
				// Instead of passing in only ITsStrings, we could pass in a structure containing
				// an index of strings with any corresponding flids.  Here we'd expect strings
				// based upon either LexemeForm.Form or LexSense.Definition. We could probably
				// do this as part of the solution to handling duplicate columns in LT-3763.
				XmlNode column = columns[i] as XmlNode;
				string columnLabel = XmlUtils.GetManditoryAttributeValue(column, "label");
				string[] columnLabelComponents = columnLabel.Split(new char[] {' ', ':'});
				// get column label without writing system or extraneous information.
				string columnBasicLabel = columnLabelComponents[0];
				if (!String.IsNullOrEmpty(columnBasicLabel) && stringTbl != null)
					columnBasicLabel = stringTbl.LocalizeAttributeValue(columnBasicLabel);
				ITsTextProps ttp = rgtss[i].get_PropertiesAt(0);
				int var;
				int ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var);
				Debug.Assert(ws != 0);

				ITsString tssStr = rgtss[i];
				string sStr = tssStr.Text;
				if (sStr == null)
					sStr = ""; // otherwise Trim below blows up.
				sStr = sStr.Trim();

				if (columnBasicLabel == Strings.ksWord)
				{
					// This is a lexeme form.

					if (morph == null)
						morph = MoForm.MakeMorph(cache, le, tssStr);
					Debug.Assert(le.LexemeFormOAHvo != 0);
					if (morph is IMoStemAllomorph)
					{
						// Make sure we have a proper allomorph and MSA for this new entry and sense.
						// (See LT-1318 for details and justification.)
						MoMorphTypeCollection typesCol = new MoMorphTypeCollection(cache);
						if (sStr.IndexOf(' ') > 0)
							morph.MorphTypeRA = typesCol.Item(MoMorphType.kmtPhrase);
						else
							morph.MorphTypeRA = typesCol.Item(MoMorphType.kmtStem);
						morph.Form.SetAlternative(sStr, ws);
					}
				}
				else if (columnBasicLabel == Strings.ksDefinition)
				{
					// This is a Definition.
					if (sStr != "")
						ls.Definition.SetAlternative(sStr, ws);
				}
				else
				{
					Debug.Fail("column (" + columnLabel + ") not supported.");
				}
			}
			if (morph == null)
				morph = le.LexemeFormOA = new MoStemAllomorph();

			ls.RDEAddDomain(hvoDomain, tagList, cache);

			if (le.MorphoSyntaxAnalysesOC.Count == 0)
			{
				// Commonly, it's a new entry with no MSAs; make sure it has at least one.
				// This way of doing it allows a good bit of code to be shared with the normal
				// creation path, as if the user made a stem but didn't fill in any grammatical
				// information.
				DummyGenericMSA dummyMsa = new DummyGenericMSA();
				if (morph != null && morph is IMoAffixForm)
					dummyMsa.MsaType = MsaType.kUnclassified;
				else
					dummyMsa.MsaType = MsaType.kStem;
				ls.DummyMSA = dummyMsa;
			}

			// We don't want a partial MSA created, so don't bother doing anything
			// about setting ls.MorphoSyntaxAnalysisRA

			// LT-1731: adding to make sure new entries are added to the lexicon
			//	record list (full edit,...)
			cache.PropChanged(null, PropChangeType.kpctNotifyAll,
				cache.LangProject.LexDbOA.Hvo,
				(int)LexDb.LexDbTags.kflidEntries, 0, 1, 0);

			return ls.Hvo;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:LingOverrides.cs

示例2: Undo

		internal void Undo(FdoCache cache)
		{
			if (m_doneSegments == null)
				return; // no change to this para
			int kflidSegments = StTxtPara.SegmentsFlid(cache);
			cache.VwCacheDaAccessor.CacheVecProp(m_hvoPara, kflidSegments, m_segments, m_segments.Length);
			cache.PropChanged(m_hvoPara, kflidSegments, 0, m_segments.Length, m_doneSegments.Length);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:AnnotationAdjuster.cs

示例3: AddToDatabase

			public void AddToDatabase(FdoCache cache, ICmPossibilityList posList, MasterCategory parent, IPartOfSpeech subItemOwner)
			{
				CheckDisposed();

				if (m_pos != null)
					return; // It's already in the database, so nothing more can be done.

				cache.BeginUndoTask(LexTextControls.ksUndoCreateCategory,
									LexTextControls.ksRedoCreateCategory);
				int newOwningFlid;
				int insertLocation;
				int newOwner =
					DeterminePOSLocationInfo(subItemOwner, parent, posList, out newOwningFlid, out insertLocation);
				ILgWritingSystemFactory wsf = cache.LanguageWritingSystemFactoryAccessor;
				Debug.Assert(m_pos != null);

				if (m_node == null)
				{ // should not happen, but just in case... we still get something useful
					m_pos.Name.SetAlternative(m_term, wsf.GetWsFromStr(m_termWs));
					m_pos.Abbreviation.SetAlternative(m_abbrev, wsf.GetWsFromStr(m_abbrevWs));
					m_pos.Description.SetAlternative(m_def, wsf.GetWsFromStr(m_defWs));
				}
				else
				{
					SetContentFromNode(cache, "abbrev", false, m_pos.Abbreviation);
					SetContentFromNode(cache, "term", true, m_pos.Name);
					SetContentFromNode(cache, "def", false, m_pos.Description);
				}

				m_pos.CatalogSourceId = m_id;
				// Need a PropChanged, since it isn't done in the 'Append' for some reason.
				cache.PropChanged(null, PropChangeType.kpctNotifyAll,
								  newOwner, newOwningFlid, insertLocation, 1, 0);
				cache.EndUndoTask();
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:35,代码来源:MasterCategoryListDlg.cs

示例4: HandleSegPropChanged

		/// <summary>
		/// If the segments of your paragraph now are different from when you were created, issue a suitable PropChanged.
		/// Enhance JohnT: we could detect more exactly where the differences lie.
		/// </summary>
		internal void HandleSegPropChanged(FdoCache cache)
		{
			int[] newSegs = GetChangedSegments(cache);
			if (newSegs != null)
			{
				cache.PropChanged(m_hvoPara, StTxtPara.SegmentsFlid(cache), 0, newSegs.Length, m_segments.Length);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:12,代码来源:AnnotationAdjuster.cs

示例5: InsertObjectIntoVirtualBackref

		static internal int InsertObjectIntoVirtualBackref(FdoCache cache, Mediator mediator, IVwVirtualHandler vh,
			int hvoSlice, uint clidNewObj, uint clidOwner, uint flid)
		{
			if (vh != null)
			{
				int clidSlice = cache.GetClassOfObject(hvoSlice);
				if (clidNewObj == LexEntry.kclsidLexEntry &&
					clidSlice == LexEntry.kclsidLexEntry &&
					clidOwner == LexDb.kclsidLexDb)
				{
					if (vh.FieldName == "VariantFormEntryBackRefs")
					{
						using (InsertVariantDlg dlg = new InsertVariantDlg())
						{
							ILexEntry entOld = LexEntry.CreateFromDBObject(cache, hvoSlice);
							dlg.SetHelpTopic("khtpInsertVariantDlg");
							dlg.SetDlgInfo(cache, mediator, entOld as IVariantComponentLexeme);
							if (dlg.ShowDialog() == DialogResult.OK && dlg.NewlyCreatedVariantEntryRefResult)
							{
								int insertPos = cache.GetVectorSize(hvoSlice, (int)flid);
								cache.PropChanged(hvoSlice, (int)flid, insertPos, 1, 0);
								return insertPos;
							}
							// say we've handled this.
							return -2;
						}
					}
				}
			}
			return -1;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:31,代码来源:Slice.cs


注:本文中的SIL.FieldWorks.FDO.FdoCache.PropChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。