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


C# IVwEnv.NoteStringValDependency方法代码示例

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


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

示例1: Display


//.........这里部分代码省略.........
						(int)StTextFrags.kfrFootnotePara);
					break;
				}

				case (int)StTextFrags.kfrText:
				{
					if (HandleEmptyText(vwenv, hvo))
						break;
					if (m_fLazy)
					{
						vwenv.AddLazyVecItems((int)StText.StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					else
					{
						vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					break;
				}
				case (int)StTextFrags.kfrFootnoteMarker:
				{
					StFootnote footnote = new StFootnote(Cache, hvo);
					if (footnote.DisplayFootnoteMarker)
						DisplayFootnoteMarker(vwenv);
					break;
				}
				case (int)StTextFrags.kfrLabel:
				{
					// The label is not editable.
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddString(m_tssLabel);
					break;
				}

				case (int)StTextFrags.kfrPara:
				case (int)StTextFrags.kfrFootnotePara:
				{
					InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
					break;
				}

				case (int)StTextFrags.kfrTranslation:
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						Editable ? (int)TptEditable.ktptIsEditable
						: (int)TptEditable.ktptNotEditable);
					// Display the translation, or its user prompt
					if (!InsertTranslationUserPrompt(vwenv, hvo))
					{
						vwenv.AddStringAltMember((int)CmTranslation.CmTranslationTags.kflidTranslation,
							m_wsDefault, this);
					}
					break;
				}
				case (int)StTextFrags.kfrSegmentFreeTranslations:
					// Hvo is a CmBaseAnnotation of one segment of an StTxtPara.
					if (IsLabelSegment(hvo))
					{
						CmBaseAnnotation segment = (CmBaseAnnotation)CmBaseAnnotation.CreateFromDBObject(Cache, hvo, false);
						vwenv.AddString(GetBackTransLabelText(segment));
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 1200, 0, 0); // a narrow space, font-neutral
					}
					else
					{
						vwenv.AddObjProp(StTxtPara.SegmentFreeTranslationFlid(Cache), this, (int)StTextFrags.kfrFreeTrans);
						vwenv.AddString(OneSpaceString);
					}
					break;
				case (int)StTextFrags.kfrFreeTrans:
					// Hvo is a CmIndirectAnnotation whose Contents are the free/back translation.
					vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(SystemColors.Window));
					ITsString tssVal = vwenv.DataAccess.get_MultiStringAlt(hvo,
						(int) CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS);
					if (tssVal.Length == 0 && !SuppressPrompt(hvo, (int)CmAnnotation.CmAnnotationTags.kflidComment))
					{
						vwenv.NoteDependency(new int[] {hvo}, new int[] {(int)CmAnnotation.CmAnnotationTags.kflidComment}, 1);
						vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, (int)CmAnnotation.CmAnnotationTags.kflidComment);
						// Almost invisibly narrow, but the Views code doesn't know it is invisible so it should prevent the prompts collapsing
						// into the margin.
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 100, 0, 0);
					}
					else
					{
						ITsStrBldr bldr = tssVal.GetBldr();
						bldr.Replace(0, bldr.Length, "", null); // reduce to empty string in ws.
						// We want it to change back to the prompt if all is deleted.
						vwenv.NoteStringValDependency(hvo, (int) CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS, bldr.GetString());
						vwenv.AddStringAltMember((int)CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS, this);
						// This little separator is useful here, too. Temporarily the comment may be displayed this way even when empty,
						// and if there is ordinary text following, it is difficult to get an IP displayed in an empty run.
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 100, 0, 0);
					}
					break;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:StVc.cs

示例2: Display

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Here a text is displayed by displaying its paragraphs;
		/// and a paragraph is displayed by invoking its style rule, making a paragraph,
		/// and displaying its contents.
		/// </summary>
		/// <param name="vwenv">view environment</param>
		/// <param name="hvo">id of object to be displayed</param>
		/// <param name="frag">fragment of data</param>
		/// -----------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch(frag)
			{
				case (int)StTextFrags.kfrFootnote:
				{
					if (HandleEmptyText(vwenv, hvo))
						break;
					IStFootnote footnote = Cache.ServiceLocator.GetInstance<IStFootnoteRepository>().GetObject(hvo);
					if (footnote.DisplayFootnoteMarker)
					{
						// We need to note this dependency here (for the update of the footnote
						// marker) instead of in the frag for the marker because noting the
						// dependency at the frag for the marker caused some weird problems
						// with the VwNotifiers which caused the view to sometimes update
						// incorrectly. (FWR-1299) It also makes more sense for it to be here
						// since the dependency would be on the whole footnote in either case
						// anyways.
						vwenv.NoteDependency(new int[] { footnote.Owner.Hvo }, new int[] { footnote.OwningFlid }, 1);
					}
					vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
						(int)StTextFrags.kfrFootnotePara);
					break;
				}

				case (int)StTextFrags.kfrText:
				{
					if (HandleEmptyText(vwenv, hvo))
						break;
					if (hvo == 0)
						return; // leave view empty, better than crashing.
					if (m_fLazy)
					{
						vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					else
					{
						vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					break;
				}
				case (int)StTextFrags.kfrFootnoteMarker:
				{
					IStFootnote footnote = Cache.ServiceLocator.GetInstance<IStFootnoteRepository>().GetObject(hvo);
					if (footnote.DisplayFootnoteMarker)
						DisplayFootnoteMarker(vwenv, footnote);
					break;
				}
				case (int)StTextFrags.kfrLabel:
				{
					// The label is not editable.
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddString(m_tssLabel);
					break;
				}

				case (int)StTextFrags.kfrPara:
				case (int)StTextFrags.kfrFootnotePara:
				{
					InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
					break;
				}

				case (int)StTextFrags.kfrTranslation:
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
						Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable);
					// Display the translation, or its user prompt
					ICmTranslation trans = Cache.ServiceLocator.GetInstance<ICmTranslationRepository>().GetObject(hvo);
					if (!InsertTranslationUserPrompt(vwenv, trans))
						vwenv.AddStringAltMember(CmTranslationTags.kflidTranslation, m_wsDefault, this);
					break;
				}
				case (int)StTextFrags.kfrSegmentFreeTranslations:
					// Hvo is one segment of an StTxtPara.
					ISegment seg = Cache.ServiceLocator.GetInstance<ISegmentRepository>().GetObject(hvo);
					if (seg.IsLabel)
					{
						// Added dependencies to get labels to update automatically (FWR-1341, FWR-1342, FWR-1417)
						vwenv.NoteStringValDependency(seg.Paragraph.Hvo, StTxtParaTags.kflidContents, 0, seg.Paragraph.Contents);
						vwenv.NoteDependency(new [] {seg.Paragraph.Hvo}, new [] {StTxtParaTags.kflidSegments}, 1);
						vwenv.AddString(GetBackTransLabelText(seg));
						vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), 1200, 0, 0); // a narrow space, font-neutral
					}
					else
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:StVc.cs


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