本文整理汇总了C#中ICmObject类的典型用法代码示例。如果您正苦于以下问题:C# ICmObject类的具体用法?C# ICmObject怎么用?C# ICmObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICmObject类属于命名空间,在下文中一共展示了ICmObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SummarySlice
/// <summary>
/// Construct one, using the "part ref" element (caller) that
/// invoked the "slice" node that specified this editor.
/// </summary>
/// <param name="caller"></param>
/// <param name="node"></param>
public SummarySlice(ICmObject obj, XmlNode caller, XmlNode node, StringTable stringTbl)
: base()
{
string paramType = XmlUtils.GetOptionalAttributeValue(node.ParentNode, "paramType");
if (paramType == "LiteralString")
{
// Instead of the parameter being a layout name, it is literal text which will be
// the whole contents of the slice, with standard properties.
string text = XmlUtils.GetManditoryAttributeValue(caller, "label");
if (stringTbl != null)
text = stringTbl.LocalizeAttributeValue(text);
m_view = new LiteralLabelView(text, this);
m_fLiteralString = true;
}
else
{
string layout = XmlUtils.GetOptionalAttributeValue(caller, "param");
if (layout == null)
layout = XmlUtils.GetManditoryAttributeValue(node, "layout");
m_view = new SummaryXmlView(obj.Hvo, layout, stringTbl, this);
}
UserControl mainControl = new UserControl();
m_view.Dock = DockStyle.Left;
m_view.LayoutSizeChanged += new EventHandler(m_view_LayoutSizeChanged);
mainControl.Height = m_view.Height;
Control = mainControl;
m_commandControl = new SummaryCommandControl(this);
m_commandControl.Dock = DockStyle.Fill;
m_commandControl.Visible = XmlUtils.GetOptionalBooleanAttributeValue(caller, "commandVisible", false);
mainControl.Controls.Add(m_commandControl);
mainControl.Dock = DockStyle.Fill;
mainControl.Controls.Add(m_view);
}
示例2: InterlinearExporter
protected InterlinearExporter(FdoCache cache, XmlWriter writer, ICmObject objRoot,
InterlinLineChoices lineChoices, InterlinVc vc)
: base(null, cache.MainCacheAccessor, objRoot.Hvo)
{
m_cache = cache;
m_writer = writer;
m_flidStTextTitle = m_cache.MetaDataCacheAccessor.GetFieldId("StText", "Title", false);
m_flidStTextSource = m_cache.MetaDataCacheAccessor.GetFieldId("StText", "Source", false);
m_vc = vc;
SetTextTitleAndMetadata(objRoot as IStText);
// Get morphtype information that we need later. (plus stuff we don't...) See LT-8288.
IMoMorphType mmtStem;
IMoMorphType mmtPrefix;
IMoMorphType mmtSuffix;
IMoMorphType mmtInfix;
IMoMorphType mmtBoundStem;
IMoMorphType mmtSimulfix;
IMoMorphType mmtSuprafix;
m_cache.ServiceLocator.GetInstance<IMoMorphTypeRepository>().GetMajorMorphTypes(
out mmtStem, out mmtPrefix, out mmtSuffix, out mmtInfix,
out mmtBoundStem, out m_mmtProclitic, out m_mmtEnclitic,
out mmtSimulfix, out mmtSuprafix);
m_wsManager = m_cache.ServiceLocator.WritingSystemManager;
m_repoObj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>();
}
示例3: SetDlgInfo
public void SetDlgInfo(FdoCache cache, Mediator mediator, ICmObject owner)
{
CheckDisposed();
m_cache = cache;
m_owner = owner;
m_helpTopic = "khtpDataNotebook-InsertRecordDlg";
m_helpTopicProvider = mediator.HelpTopicProvider;
if (m_helpTopicProvider != null) // Will be null when running tests
{
m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
}
IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
m_titleTextBox.StyleSheet = stylesheet;
m_titleTextBox.WritingSystemFactory = m_cache.WritingSystemFactory;
m_titleTextBox.WritingSystemCode = m_cache.DefaultAnalWs;
AdjustControlAndDialogHeight(m_titleTextBox, m_titleTextBox.PreferredHeight);
m_typeCombo.StyleSheet = stylesheet;
m_typeCombo.WritingSystemFactory = m_cache.WritingSystemFactory;
m_typeCombo.WritingSystemCode = m_cache.DefaultAnalWs;
AdjustControlAndDialogHeight(m_typeCombo, m_typeCombo.PreferredHeight);
ICmPossibilityList recTypes = m_cache.LanguageProject.ResearchNotebookOA.RecTypesOA;
m_typePopupTreeManager = new PossibilityListPopupTreeManager(m_typeCombo, m_cache, mediator,
recTypes, cache.DefaultAnalWs, false, this);
m_typePopupTreeManager.LoadPopupTree(m_cache.ServiceLocator.GetObject(RnResearchNbkTags.kguidRecObservation).Hvo);
// Ensure that we start out focused in the Title text box. See FWR-2731.
m_titleTextBox.Select();
}
示例4: Init
public void Init(Mediator mediator, XmlNode configurationNode, ICmObject sourceObject)
{
CheckDisposed();
m_cache = sourceObject.Cache;
// Find the sense owning our LexExampleSentence
if (sourceObject is LexExampleSentence)
{
m_les = sourceObject as LexExampleSentence;
m_owningSense = LexSense.CreateFromDBObject(m_cache, m_les.OwnerHVO);
}
else if (sourceObject is LexSense)
{
m_owningSense = sourceObject as ILexSense;
}
else
{
throw new ArgumentException("Invalid object type for sourceObject.");
}
m_mediator = mediator;
m_configurationNode = configurationNode;
AddConfigurableControls();
m_virtFlidReference = BaseVirtualHandler.GetInstalledHandlerTag(m_cache, "CmBaseAnnotation", "Reference");
}
示例5: GetCustomFieldValues
protected BsonDocument GetCustomFieldValues(FdoCache cache, ICmObject obj, string objectType = "entry")
{
// The objectType parameter is used in the names of the custom fields (and nowhere else).
var convertCustomField = new ConvertFdoToMongoCustomField(cache, new LfMerge.Logging.NullLogger());
Dictionary<string, LfConfigFieldBase> lfCustomFieldList = new Dictionary<string, LfConfigFieldBase>();
return convertCustomField.GetCustomFieldsForThisCmObject(obj, objectType, _listConverters, lfCustomFieldList);
}
示例6: ValidateObject
/// <summary>
/// Validate the object, before it goes into the collection,
/// as it may not be in the DB yet.
/// </summary>
/// <param name="obj">Object to validate.</param>
/// <returns>The same object as was being validated, but with a good ID.</returns>
protected ICmObject ValidateObject(ICmObject obj)
{
Debug.Assert(m_fdoCache != null);
if (obj.Hvo == (int)CmObject.SpecialHVOValues.kHvoOwnerPending)
(obj as CmObject).InitNew(m_fdoCache);
return obj;
}
示例7: RunMacro
public void RunMacro(ICmObject target, int targetField, int wsId, int startOffset, int length)
{
var example = target as ILexExampleSentence ?? target.OwnerOfClass<ILexExampleSentence>();
var sense = example.OwnerOfClass<ILexSense>();
var entry = sense.Entry;
if (!(entry.LexemeFormOA is IMoStemAllomorph))
{
MessageBox.Show("This macro only works on stems");
return;
}
var newEntry = entry.Services.GetInstance<ILexEntryFactory>().Create();
var newSense = entry.Services.GetInstance<ILexSenseFactory>().Create();
newEntry.SensesOS.Add(newSense);
newSense.ExamplesOS.Add(example); // moves the chosen example
// Would be nice to use CopyObject, but currently not public
newEntry.LexemeFormOA = entry.Services.GetInstance<IMoStemAllomorphFactory>().Create();
foreach (var ws in entry.LexemeFormOA.Form.AvailableWritingSystemIds)
newEntry.LexemeFormOA.Form.set_String(ws, entry.LexemeFormOA.Form.get_String(ws));
foreach (var ws in sense.Gloss.AvailableWritingSystemIds)
newSense.Gloss.set_String(ws, sense.Gloss.get_String(ws));
foreach (var ws in sense.Definition.AvailableWritingSystemIds)
newSense.Definition.set_String(ws, sense.Gloss.get_String(ws));
// Enhance JohnT: maybe there is more stuff we want to copy?
//Now make it a subentry
var ler = entry.Services.GetInstance<ILexEntryRefFactory>().Create();
newEntry.EntryRefsOS.Add(ler);
ler.RefType = LexEntryRefTags.krtComplexForm; // must be a complex form to be a subentry
ler.ComponentLexemesRS.Add(entry);
ler.PrimaryLexemesRS.Add(entry);
}
示例8: InsertErrorAnnotation
/// ------------------------------------------------------------------------------------
/// <summary>
/// Insert a new check result annotation at its correct position in the list.
/// </summary>
/// <param name="startRef">beginning reference note refers to</param>
/// <param name="endRef">ending reference note refers to</param>
/// <param name="beginObject">id of beginning object note refers to</param>
/// <param name="endObject">id of ending object note refers to</param>
/// <param name="checkId">The check id.</param>
/// <param name="bldrQuote">Para builder to use for the cited text paragraph</param>
/// <param name="bldrDiscussion">Para builder to use to build the Discussion
/// paragraph</param>
/// <returns>note inserted into annotation list</returns>
/// ------------------------------------------------------------------------------------
public IScrScriptureNote InsertErrorAnnotation(BCVRef startRef, BCVRef endRef,
ICmObject beginObject, ICmObject endObject, Guid checkId,
StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion)
{
return InsertNote(startRef, endRef, beginObject, endObject, checkId, -1,
0, 0, bldrQuote, bldrDiscussion, null, null, GetInsertIndexForRef(startRef));
}
示例9: LinksForField
public List<XmlImportData.PendingLink> LinksForField(ICmObject owner, int flid)
{
List<XmlImportData.PendingLink> linksForOwner;
if (!m_lookupLinks.TryGetValue(owner, out linksForOwner))
return new List<XmlImportData.PendingLink>(); // nothing is linked from this owner.
return (from link in linksForOwner where link.FieldInformation.FieldId == flid select link).ToList();
}
示例10: MSAReferenceComboBoxSlice
/// ------------------------------------------------------------------------------------
/// <summary>
/// Constructor.
/// </summary>
/// <param name="cache">FDO cache.</param>
/// <param name="obj">CmObject that is being displayed.</param>
/// <param name="flid">The field identifier for the attribute we are displaying.</param>
/// <param name="persistenceProvider">The persistence provider.</param>
/// ------------------------------------------------------------------------------------
public MSAReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid,
IPersistenceProvider persistenceProvider)
: base(new UserControl(), cache, obj, flid)
{
IWritingSystem defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem;
m_persistProvider = persistenceProvider;
m_tree = new TreeCombo();
m_tree.WritingSystemFactory = cache.WritingSystemFactory;
m_tree.Font = new System.Drawing.Font(defAnalWs.DefaultFontName, 10);
if (!Application.RenderWithVisualStyles)
m_tree.HasBorder = false;
m_tree.WritingSystemCode = defAnalWs.Handle;
// We embed the tree combo in a layer of UserControl, so it can have a fixed width
// while the parent window control is, as usual, docked 'fill' to work with the splitter.
m_tree.Dock = DockStyle.Left;
m_tree.Width = 240;
m_tree.DropDown += m_tree_DropDown;
Control.Controls.Add(m_tree);
m_tree.SizeChanged += m_tree_SizeChanged;
if (m_cache != null)
m_cache.DomainDataByFlid.AddNotification(this);
m_treeBaseWidth = m_tree.Width;
// m_tree has sensible PreferredHeight once the text is set, UserControl does not.
//we need to set the Height after m_tree.Text has a value set to it.
Control.Height = m_tree.PreferredHeight;
}
示例11: PhEnvStrRepresentationSlice
/// <summary>
/// We want the persistence provider, and the easiest way to get it is to get all
/// this other stuff we don't need or use.
/// </summary>
/// <param name="cache"></param>
/// <param name="editor"></param>
/// <param name="flid"></param>
/// <param name="node"></param>
/// <param name="obj"></param>
/// <param name="stringTbl"></param>
/// <param name="persistenceProvider"></param>
/// <param name="ws"></param>
public PhEnvStrRepresentationSlice(FdoCache cache, string editor, int flid,
System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
IPersistenceProvider persistenceProvider, int ws)
: base(new StringRepSliceView(obj.Hvo), obj, StringRepSliceVc.Flid)
{
m_persistenceProvider = persistenceProvider;
}
示例12: GhostLexRefLauncher
public GhostLexRefLauncher(ICmObject obj, XmlNode configNode)
{
m_obj = obj;
m_configurationNode = configNode;
// Makes the rest of the control look like content, though empty.
BackColor = System.Drawing.SystemColors.Window;
}
示例13: Init
public void Init(Mediator mediator, XmlNode configurationNode, ICmObject sourceObject)
{
CheckDisposed();
m_cache = sourceObject.Cache;
// Find the sense we want examples for, which depends on the kind of source object.
if (sourceObject is ILexExampleSentence)
{
m_les = sourceObject as ILexExampleSentence;
m_owningSense = (ILexSense)m_les.Owner;
}
else if (sourceObject is ILexSense)
{
m_owningSense = sourceObject as ILexSense;
}
else
{
throw new ArgumentException("Invalid object type for sourceObject.");
}
m_mediator = mediator;
m_configurationNode = configurationNode;
helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
helpProvider.SetShowHelp(this, true);
if (m_mediator.HelpTopicProvider != null)
{
helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic));
btnHelp.Enabled = true;
}
AddConfigurableControls();
}
示例14: Initialize
public void Initialize(ICmObject rootObj, int rootFlid, FdoCache cache, string displayNameProperty,
XCore.Mediator mediator, string displayWs)
{
CheckDisposed();
m_displayWs = displayWs;
base.Initialize(rootObj, rootFlid, cache, displayNameProperty, mediator);
}
示例15: Initialize
public void Initialize(ICmObject rootObj, int rootFlid, string rootFieldName, FdoCache cache, string displayNameProperty,
Mediator mediator, string displayWs)
{
CheckDisposed();
m_displayWs = displayWs;
Initialize(rootObj, rootFlid, rootFieldName, cache, displayNameProperty, mediator);
}