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


C# ILgWritingSystemFactory.GetWritingSystems方法代码示例

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


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

示例1: DeterminePasteWs

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get a value determining if the new writing systems should be created as a side-effect
		/// of a paste operation.
		/// </summary>
		/// <param name="wsf">writing system factory containing the new writing systems</param>
		/// <param name="destWs">The destination writing system (writing system used at the
		/// selection).</param>
		/// <returns>
		/// 	an indication of how the paste should be handled.
		/// </returns>
		/// ------------------------------------------------------------------------------------
		public override PasteStatus DeterminePasteWs(ILgWritingSystemFactory wsf, out int destWs)
		{
			// Determine writing system at selection (destination for paste).
			destWs = 0;
			if (CurrentSelection != null)
				destWs = CurrentSelection.GetWritingSystem(SelectionHelper.SelLimitType.Anchor);
			if (destWs <= 0)
				destWs = Cache.DefaultAnalWs; // set to default analysis, if 0.

			// Get list of writing system names.
			List<string> wsMissingNames = new List<string>();
			int cws = wsf.NumberOfWs;

			using (ArrayPtr ptr = MarshalEx.ArrayToNative(cws, typeof(int)))
			{
				wsf.GetWritingSystems(ptr, cws);
				int[] vws = (int[])MarshalEx.NativeToArray(ptr, cws, typeof(int));

				IWritingSystem ws;
				for (int iws = 0; iws < cws; iws++)
				{
					if (vws[iws] == 0)
						continue;
					ws = wsf.get_EngineOrNull(vws[iws]);
					if (ws == null)
					{
						// found corrupt writing system--don't want to use any ws in this pasted string
						return PasteStatus.UseDestWs;
					}
					if (Cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr(ws.IcuLocale) == 0)
						wsMissingNames.Add(ws.LanguageName); // writing system not found in ws factory
				}
			}

			PasteStatus pasteStatus;
			if (wsMissingNames.Count > 0)
			{
				if (!Options.ShowPasteWsChoice)
					return PasteStatus.UseDestWs;

				// Ask user whether to use destination writing system or copy original writing systems.
				LgWritingSystem lgws = new LgWritingSystem(Cache, destWs);
				Debug.Assert(lgws != null);
				using (AddWsFromPastedTextDlg newWsDlg = new AddWsFromPastedTextDlg(
					m_cache.LangProject.Name.BestAnalysisAlternative.Text,
					lgws.Name.BestAnalysisAlternative.Text, wsMissingNames))
				{
					newWsDlg.ShowDialog(Control.FindForm());
					pasteStatus = newWsDlg.PasteStatus;
				}
			}
			else // no missing writing systems in TsString to paste
				pasteStatus = PasteStatus.PreserveWs;

			return pasteStatus;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:68,代码来源:NotesEditingHelper.cs

示例2: GetPossibleWritingSystemsToSelectByInputLanguage

		/// <summary>
		/// get the writing systems we should consider as candidates to be selected whent the user makes an
		/// external choice of keyboard. overridden in root site to use only active ones.
		/// </summary>
		/// <param name="wsf"></param>
		/// <returns></returns>
		protected virtual int[] GetPossibleWritingSystemsToSelectByInputLanguage(ILgWritingSystemFactory wsf)
		{
			int cws = wsf.NumberOfWs;
			int[] vwsTemp = new int[0];
			using (ArrayPtr ptr = MarshalEx.ArrayToNative<int>(cws))
			{
				wsf.GetWritingSystems(ptr, cws);
				vwsTemp = MarshalEx.NativeToArray<int>(ptr, cws);
			}
			return vwsTemp;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:SimpleRootSite.cs

示例3: ConvertersInUse

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Return a hash table from converter name to writing system name for converters
		/// that are currently in use by some writing system. (This is a needed argument
		/// for initializeing an AddCnvtrDlg, so that it can avoid deleting converters that
		/// are currently in use by writing systems.)
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public static Set<string> ConvertersInUse(ILgWritingSystemFactory wsf)
		{
			Set<string> wsInUse = new Set<string>();
			// Make a hash of the writing systems currently in use.
			IWritingSystem currentWS;
			int cws = wsf.NumberOfWs;

			using (ArrayPtr ptr = MarshalEx.ArrayToNative(cws, typeof(int)))
			{
				wsf.GetWritingSystems(ptr, cws);
				int[] vws = (int[])MarshalEx.NativeToArray(ptr, cws, typeof(int));

				for (int iws = 0; iws < cws; iws++)
				{
					if (vws[iws] == 0)
						continue;
					currentWS = wsf.get_EngineOrNull(vws[iws]);
					if (currentWS == null)
						continue;
					string legMapping = currentWS.LegacyMapping;
					if (legMapping == null)
						continue;
					wsInUse.Add(legMapping);
				}
			}
			return wsInUse;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:35,代码来源:WritingSystemPropertiesDialog.cs

示例4: DeterminePasteWs

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get a value determining if the new writing systems should be created as a side-effect
		/// of a paste operation.
		/// </summary>
		/// <param name="wsf">writing system factory containing the new writing systems</param>
		/// <param name="destWs">The destination writing system (writing system used at the
		/// selection).</param>
		/// <returns>
		/// 	an indication of how the paste should be handled.
		/// </returns>
		/// ------------------------------------------------------------------------------------
		public override PasteStatus DeterminePasteWs(ILgWritingSystemFactory wsf, out int destWs)
		{
			// Determine writing system at selection (destination for paste).
			destWs = 0;
			if (CurrentSelection != null)
				destWs = CurrentSelection.GetWritingSystem(SelectionHelper.SelLimitType.Anchor);
			if (destWs <= 0)
				destWs = Cache.DefaultAnalWs; // set to default analysis, if 0.

			int cws = wsf.NumberOfWs;

			using (ArrayPtr ptr = MarshalEx.ArrayToNative<int>(cws))
			{
				wsf.GetWritingSystems(ptr, cws);
				int[] vws = MarshalEx.NativeToArray<int>(ptr, cws);

				for (int iws = 0; iws < cws; iws++)
				{
					if (vws[iws] != 0 && wsf.get_EngineOrNull(vws[iws]) == null)
					{
						// found corrupt writing system--don't want to use any ws in this pasted string
						return PasteStatus.UseDestWs;
					}
				}
			}

			return PasteStatus.PreserveWs;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:40,代码来源:NotesEditingHelper.cs


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