本文整理汇总了C#中IWritingSystem类的典型用法代码示例。如果您正苦于以下问题:C# IWritingSystem类的具体用法?C# IWritingSystem怎么用?C# IWritingSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWritingSystem类属于命名空间,在下文中一共展示了IWritingSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDialog
/// <summary>
/// sets up the dialog without actually showing it.
/// </summary>
/// <param name="ws">The writing system which properties will be displayed</param>
/// <returns>A DialogResult value</returns>
public int ShowDialog(IWritingSystem ws)
{
CheckDisposed();
SetupDialog(ws, true);
return (int)DialogResult.OK;
}
示例2: MergeWritingSystemDlg
public MergeWritingSystemDlg(FdoCache cache, IWritingSystem ws, IEnumerable<IWritingSystem> wss, IHelpTopicProvider helpTopicProvider)
{
m_cache = cache;
m_ws = ws;
//
// Required for Windows Form Designer support
//
InitializeComponent();
Icon infoIcon = SystemIcons.Information;
m_infoPictureBox.Image = infoIcon.ToBitmap();
m_infoPictureBox.Size = infoIcon.Size;
foreach (IWritingSystem curWs in wss.Except(new[] { ws }))
m_wsListBox.Items.Add(curWs);
m_wsListBox.SelectedIndex = 0;
m_helpTopicProvider = helpTopicProvider;
if (m_helpTopicProvider != null) // m_helpTopicProvider could be null for testing
{
m_helpProvider = new HelpProvider();
m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(HelpTopic));
m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
}
}
示例3: ShowDialog
/// <summary>
/// sets up the dialog without actually showing it.
/// </summary>
/// <param name="ws">The writing system which properties will be displayed</param>
/// <returns>A DialogResult value</returns>
public int ShowDialog(IWritingSystem ws)
{
CheckDisposed();
SetupDialog(ws, true);
SwitchTab(kWsSorting); // force setup of the Sorting tab
return (int)DialogResult.OK;
}
示例4: TryLoadValidCharsIfEmpty
/// ----------------------------------------------------------------------------------------
/// <summary>
/// For a given LanguageDefinition, if the ValidChars field is empty then try to get a set
/// of ExemplarCharacters (valid characters) from ICU for this language.
/// </summary>
/// <param name="ws"></param>
/// <param name="cpe">A character property engine (needed for normalization).</param>
/// ----------------------------------------------------------------------------------------
public static void TryLoadValidCharsIfEmpty(IWritingSystem ws,
ILgCharacterPropertyEngine cpe)
{
//Try to load the ValidChars if none have been loaded yet.
if (string.IsNullOrEmpty(ws.ValidChars))
{
string IcuLocale = ws.LanguageSubtag.Code;
ws.ValidChars = GetValidCharsForLocale(IcuLocale, cpe);
}
}
示例5: GetSelAtStartOfWs
internal static IVwSelection GetSelAtStartOfWs(IVwRootBox rootBox, int flid, int wsIndex, IWritingSystem ws)
{
try
{
return rootBox.MakeTextSelection(0, 0, null, flid, wsIndex, 0, 0, (ws == null) ? 0 : ws.Handle, false, -1, null, false);
}
catch (COMException)
{
return null; // can fail if we are hiding an empty WS.
}
}
示例6: PaWritingSystem
/// ------------------------------------------------------------------------------------
private PaWritingSystem(IWritingSystem lgws, IFdoServiceLocator svcloc, bool isVern,
bool isAnal)
{
Id = lgws.Id;
DisplayName = lgws.DisplayLabel;
LanguageName = lgws.LanguageName;
Abbreviation = lgws.Abbreviation;
IcuLocale = lgws.IcuLocale;
Hvo = lgws.Handle;
DefaultFontName = lgws.DefaultFontName;
IsVernacular = isVern;
IsAnalysis = isAnal;
IsDefaultAnalysis = (lgws == svcloc.WritingSystems.DefaultAnalysisWritingSystem);
IsDefaultVernacular = (lgws == svcloc.WritingSystems.DefaultVernacularWritingSystem);
IsDefaultPronunciation = (lgws == svcloc.WritingSystems.DefaultPronunciationWritingSystem);
}
示例7: ITsStringAltChangedSideEffectsInternal
/// ------------------------------------------------------------------------------------
/// <summary>
/// Subclasses should override this, if they need to have side effects.
/// </summary>
/// <param name="multiAltFlid"></param>
/// <param name="alternativeWs"></param>
/// <param name="originalValue"></param>
/// <param name="newValue"></param>
/// ------------------------------------------------------------------------------------
protected override void ITsStringAltChangedSideEffectsInternal(int multiAltFlid,
IWritingSystem alternativeWs, ITsString originalValue, ITsString newValue)
{
base.ITsStringAltChangedSideEffectsInternal(multiAltFlid, alternativeWs, originalValue, newValue);
// Make sure the translation belongs to Scripture.
ScrTxtPara para = Owner as ScrTxtPara;
if (para == null || TypeRA == null)
return;
if (multiAltFlid == CmTranslationTags.kflidTranslation &&
TypeRA.Guid == CmPossibilityTags.kguidTranBackTranslation &&
((originalValue == null && newValue != null) ||
(originalValue != null && newValue == null) ||
(originalValue != null && originalValue.Text != newValue.Text)))
{
BtConverter.ConvertCmTransToInterlin(para, alternativeWs.Handle);
MarkAsUnfinished(alternativeWs.Handle);
}
}
示例8: Copy
/// <summary>
/// Copies all of the properties from the source writing system to this writing system.
/// </summary>
/// <param name="source">The source writing system.</param>
public void Copy(IWritingSystem source)
{
DateTime dateModified;
int lcid;
string spellCheckingId, defFontFeats, defFont, keyboard, abbr, sortRules, validChars, matchedPairs, punctPatterns,
quotationMarks, legacyMapping;
bool rtol, isGraphiteEnabled;
bool isVoice;
SortRulesType sortUsing;
LanguageSubtag languageSubtag;
ScriptSubtag scriptSubtag;
RegionSubtag regionSubtag;
VariantSubtag variantSubtag;
var pws = (PalasoWritingSystem) source;
lock (pws.m_syncRoot)
{
// ILgWritingSystem properties
spellCheckingId = pws.SpellCheckingId;
rtol = pws.RightToLeftScript;
defFontFeats = pws.DefaultFontFeatures;
defFont = pws.DefaultFontName;
keyboard = pws.Keyboard;
// This will put the keyboard actually selected into the permanent WS's list.
// We don't need to remember any others that got temporarily added to KnownKeyboards for testing.
LocalKeyboard = pws.LocalKeyboard;
// IWritingSystem properties
abbr = pws.Abbreviation;
sortUsing = pws.SortUsing;
sortRules = pws.SortRules;
//copy the IsVoice property, see comment in assignment below.
isVoice = pws.IsVoice;
languageSubtag = pws.LanguageSubtag;
scriptSubtag = pws.ScriptSubtag;
regionSubtag = pws.RegionSubtag;
variantSubtag = pws.VariantSubtag;
validChars = pws.ValidChars;
matchedPairs = pws.MatchedPairs;
punctPatterns = pws.PunctuationPatterns;
quotationMarks = pws.QuotationMarks;
legacyMapping = pws.LegacyMapping;
isGraphiteEnabled = pws.IsGraphiteEnabled;
dateModified = pws.DateModified;
}
lock (m_syncRoot)
{
// ILgWritingSystem properties
SpellCheckingId = spellCheckingId;
RightToLeftScript = rtol;
DefaultFontFeatures = defFontFeats;
DefaultFontName = defFont;
Keyboard = keyboard;
// IWritingSystem properties
Abbreviation = abbr;
SortUsing = sortUsing;
SortRules = sortRules;
//To meet the previously undocumented pre-conditions of the Script property the IsVoice must be set before the ScriptSubTag
//the values which the IsVoice property is based on will be re-set again by other properties, rather than try and arrange
//the other SubTags which affect those properties I'm just setting IsVoice here -naylor 8/10/2011
IsVoice = isVoice;
LanguageSubtag = languageSubtag;
ScriptSubtag = scriptSubtag;
RegionSubtag = regionSubtag;
VariantSubtag = variantSubtag;
ValidChars = validChars;
MatchedPairs = matchedPairs;
PunctuationPatterns = punctPatterns;
QuotationMarks = quotationMarks;
LegacyMapping = legacyMapping;
IsGraphiteEnabled = isGraphiteEnabled;
DateModified = dateModified;
}
}
示例9: SetPropertiesBasedOnStyle
/// ------------------------------------------------------------------------------------
/// <summary>
/// Sets the properties of this entry based on the given FW style.
/// </summary>
/// ------------------------------------------------------------------------------------
public override void SetPropertiesBasedOnStyle(IStStyle style, IWritingSystem forceStyleInfo)
{
base.SetPropertiesBasedOnStyle(style, forceStyleInfo);
m_textPropertiesFromStyFile = null;
}
示例10: WsMenuItem
/// --------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
/// <param name="ws"></param>
/// <param name="list"></param>
/// <param name="handler">OnClick event handler</param>
/// --------------------------------------------------------------------------------
public WsMenuItem(IWritingSystem ws, ListBox list, EventHandler handler)
: base(ws.DisplayLabel, null, handler)
{
m_ws = ws;
m_list = list;
}
示例11: InitializeWsTab
/// ------------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
/// ------------------------------------------------------------------------------------
private void InitializeWsTab()
{
using (new WaitCursor(this))
{
// Add writing system names to the vernacular list.
foreach (IWritingSystem ws in m_langProj.CurrentVernacularWritingSystems)
m_lstVernWs.Items.Add(ws, true);
// Add writing system names to the analysis list.
foreach (IWritingSystem ws in m_langProj.CurrentAnalysisWritingSystems)
m_lstAnalWs.Items.Add(ws, true);
// Now add the unchecked (or not current) writing systems to the vern. list.
foreach (IWritingSystem ws in m_langProj.VernacularWritingSystems)
{
if (!m_lstVernWs.Items.Contains(ws))
m_lstVernWs.Items.Add(ws, false);
}
// Now add the unchecked (or not current) writing systems to the anal. list.
foreach (IWritingSystem ws in m_langProj.AnalysisWritingSystems)
{
if (!m_lstAnalWs.Items.Contains(ws))
m_lstAnalWs.Items.Add(ws, false);
}
// Select the first item in the vernacular writing system list.
if (m_lstVernWs.Items.Count > 0)
{
m_lstVernWs.SelectedIndex = 0;
m_topVernWs = (IWritingSystem) m_lstVernWs.CheckedItems[0];
}
// Select the first item in the analysis writing system list.
if (m_lstAnalWs.Items.Count > 0)
m_lstAnalWs.SelectedIndex = 0;
UpdateOKButton();
}
}
示例12: PopulateWsContextMenu
static internal void PopulateWsContextMenu(ContextMenuStrip cmnuAddWs, IEnumerable<IWritingSystem> wssToAdd,
ListBox listToAddTo, EventHandler clickHandlerExistingWs, EventHandler clickHandlerNewWs,
EventHandler clickHandlerNewWsFromSelected, IWritingSystem selectedWs)
{
cmnuAddWs.Items.Clear();
cmnuAddWs.Tag = listToAddTo;
// Add the "Writing system for <language>..." menu item.
IEnumerable<IWritingSystem> relatedWss = Enumerable.Empty<IWritingSystem>();
if (clickHandlerNewWsFromSelected != null && selectedWs != null)
{
// Populate Context Menu with related wss.
relatedWss = wssToAdd.Related(selectedWs).ToArray();
AddExistingWssToContextMenu(cmnuAddWs, relatedWss, listToAddTo, clickHandlerExistingWs);
ToolStripItem tsiNewWs = new ToolStripMenuItem(string.Format(FwCoreDlgs.ksWsNewFromExisting, selectedWs.LanguageSubtag.Name),
null, clickHandlerNewWsFromSelected);
cmnuAddWs.Items.Add(tsiNewWs);
}
// Add a separator and the "New..." menu item.
if (clickHandlerNewWs != null)
{
AddExistingWssToContextMenu(cmnuAddWs, wssToAdd.Except(relatedWss), listToAddTo, clickHandlerExistingWs);
// Convert from Set to List, since the Set can't sort.
if (cmnuAddWs.Items.Count > 0)
cmnuAddWs.Items.Add(new ToolStripSeparator());
ToolStripItem tsiNewWs = new ToolStripMenuItem(FwCoreDlgs.ksWsNew, null, clickHandlerNewWs);
cmnuAddWs.Items.Add(tsiNewWs);
}
}
示例13: AddWsToList
/// ------------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
/// <param name="ws"></param>
/// <param name="list"></param>
/// ------------------------------------------------------------------------------------
protected static void AddWsToList(IWritingSystem ws, CheckedListBox list)
{
list.Items.Add(ws, true);
list.SelectedItem = ws;
}
示例14: InterpretWsLabel
/// <summary>
/// Try to get an actual writing system id from some ws string specification.
/// If it does not recognize the ws spec string, it returns 0.
/// </summary>
/// <param name="cache"></param>
/// <param name="wsSpec"></param>
/// <param name="wsDefault"></param>
/// <param name="hvoObj"></param>
/// <param name="flid"></param>
/// <param name="currentWS"></param>
/// <param name="wsMagic">returns the equivalent magic ws value</param>
/// <returns>An actual writing system id, or 0, if it can't recognize the wsSpec parameter.</returns>
public static int InterpretWsLabel(FdoCache cache, string wsSpec, int wsDefault,
int hvoObj, int flid, IWritingSystem currentWS, out int wsMagic)
{
wsMagic = GetMagicWsIdFromName(wsSpec); // note: doesn't cover "va" and "av".
int actualWS;
switch (wsSpec)
{
case "vernacular":
actualWS = cache.LangProject.ActualWs(kwsVern, hvoObj, flid);
break;
case "analysis":
actualWS = cache.LangProject.ActualWs(kwsAnal, hvoObj, flid);
break;
case "best analysis":
actualWS = cache.LangProject.ActualWs(kwsFirstAnal, hvoObj, flid);
if (actualWS == 0)
actualWS = wsDefault;
break;
case "best vernacular":
actualWS = cache.LangProject.ActualWs(kwsFirstVern, hvoObj, flid);
if (actualWS == 0)
actualWS = wsDefault;
break;
case "best analorvern":
actualWS = cache.LangProject.ActualWs(kwsFirstAnalOrVern, hvoObj, flid);
if (actualWS == 0)
actualWS = wsDefault;
break;
case "best vernoranal":
actualWS = cache.LangProject.ActualWs(kwsFirstVernOrAnal, hvoObj, flid);
if (actualWS == 0)
actualWS = wsDefault;
break;
case "pronunciation":
case "all pronunciation": // fixes LT-6665.
actualWS = cache.LangProject.DefaultPronunciationWritingSystem;
break;
case "current":
if (currentWS != null)
actualWS = currentWS.WritingSystem;
else
actualWS = cache.DefaultUserWs;
break;
case "reversal":
actualWS = GetReversalIndexEntryWritingSystem(cache, hvoObj, wsDefault);
break;
case "analysis vernacular":
case "av":
// Sometimes this is done, e.g., to figure out something about overall behavior of a column,
// and we don't have a specific HVO. Since we prefer the analysis one, answer it when we don't
// have a specific HVO.
if (hvoObj == 0)
actualWS = cache.DefaultAnalWs;
else if (cache.MainCacheAccessor.get_MultiStringAlt(hvoObj, flid, cache.DefaultAnalWs).Length > 0)
actualWS = cache.DefaultAnalWs;
else if (cache.MainCacheAccessor.get_MultiStringAlt(hvoObj, flid, cache.DefaultVernWs).Length > 0)
actualWS = cache.DefaultVernWs;
else
actualWS = cache.DefaultAnalWs;
break;
case "vernacular analysis":
case "va":
if (hvoObj == 0)
actualWS = cache.DefaultVernWs;
else if (cache.MainCacheAccessor.get_MultiStringAlt(hvoObj, flid, cache.DefaultVernWs).Length > 0)
actualWS = cache.DefaultVernWs;
else if (cache.MainCacheAccessor.get_MultiStringAlt(hvoObj, flid, cache.DefaultAnalWs).Length > 0)
actualWS = cache.DefaultAnalWs;
else
actualWS = cache.DefaultVernWs;
break;
case "user":
actualWS = cache.DefaultUserWs;
break;
default:
// See if we can get anywhere by treating it as an ICU locale.
// Note that it is important to do this in a way that won't create a new writing system for
// an invalid locale name, for example, if 'all analysis' is mistakenly passed to this routine.
// Note however that the behavior of recognizing an ICU locale name for an existing writing system
// definitely IS needed, e.g., when the user configures a Browse view to show an explicit writing system.
int wsT = cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr(wsSpec);
if (wsT == 0)
actualWS = wsDefault;
else
actualWS = wsT;
break;
}
return actualWS;
//.........这里部分代码省略.........
示例15: ShowAddWsContextMenu
static internal void ShowAddWsContextMenu(ContextMenuStrip cmnuAddWs,
IEnumerable<IWritingSystem> wssToAdd, ListBox listToAddTo, Button button,
EventHandler clickHandlerExistingWs, EventHandler clickHandlerNewWs,
EventHandler clickHandlerNewWsFromSelected, IWritingSystem selectedWs)
{
try
{
PopulateWsContextMenu(cmnuAddWs, wssToAdd, listToAddTo, clickHandlerExistingWs, clickHandlerNewWs,
clickHandlerNewWsFromSelected, selectedWs);
cmnuAddWs.Show(button, new Point(0, button.Height));
}
catch (Exception e)
{
Form form = cmnuAddWs.FindForm();
Control owner = null;
if (form != null)
owner = form.Owner;
MessageBoxUtils.Show(owner,
string.Format(ResourceHelper.GetResourceString("kstidMiscErrorWithMessage"), e.Message),
ResourceHelper.GetResourceString("kstidMiscError"));
}
}