本文整理汇总了C#中ICmObject类的典型用法代码示例。如果您正苦于以下问题:C# ICmObject类的具体用法?C# ICmObject怎么用?C# ICmObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICmObject类属于命名空间,在下文中一共展示了ICmObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:40,代码来源:SummarySlice.cs
示例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>();
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:27,代码来源:InterlinearExporter.cs
示例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();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:InsertRecordDlg.cs
示例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");
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:27,代码来源:FindExampleSentenceDlg.cs
示例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);
}
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:7,代码来源:RoundTripBase.cs
示例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;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:13,代码来源:FdoTypeSafeCollections.cs
示例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);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:31,代码来源:ExampleToSubentry.cs
示例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));
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:21,代码来源:ScrScriptureNote.cs
示例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();
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:ReferenceTracker.cs
示例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;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:40,代码来源:MSAReferenceComboBoxSlice.cs
示例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;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:19,代码来源:PhEnvStrRepresentationSlice.cs
示例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;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:7,代码来源:GhostLexRefSlice.cs
示例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();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:FindExampleSentenceDlg.cs
示例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);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:7,代码来源:VectorReferenceView.cs
示例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);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:VectorReferenceView.cs
示例16: AddObjectEventArgs
/// <summary>
/// Construct one. For the index, pass -1 for a collection and -2 for atomic.
/// </summary>
public AddObjectEventArgs(ICmObject newby, int flid, int index)
{
if (newby == null) throw new ArgumentNullException("newby");
ObjectAdded = newby;
Flid = flid;
m_index = index;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:AddObjectEventArgs.cs
示例17: AddItem
/// <summary>
/// The user selected an item; now we actually need a LexEntryRef.
/// </summary>
/// <param name="hvoNew"></param>
private void AddItem(ICmObject newObj)
{
CheckDisposed();
bool fForVariant = XmlUtils.GetOptionalBooleanAttributeValue(m_configurationNode, "forVariant", false);
string sUndo, sRedo;
if (fForVariant)
{
sUndo = LexEdStrings.ksUndoVariantOf;
sRedo = LexEdStrings.ksRedoVariantOf;
}
else
{
sUndo = LexEdStrings.ksUndoAddComponent;
sRedo = LexEdStrings.ksRedoAddComponent;
}
try
{
UndoableUnitOfWorkHelper.Do(sUndo, sRedo, m_obj,
() =>
{
ILexEntry ent = m_obj as ILexEntry;
// Adapted from part of DtMenuHandler.AddNewLexEntryRef.
ILexEntryRef ler = ent.Services.GetInstance<ILexEntryRefFactory>().Create();
ent.EntryRefsOS.Add(ler);
if (fForVariant)
{
// The slice this is part of should only be displayed for lex entries with no VariantEntryRefs.
Debug.Assert(ent.VariantEntryRefs.Count() == 0);
ler.VariantEntryTypesRS.Add(ent.Cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS[0] as ILexEntryType);
ler.RefType = LexEntryRefTags.krtVariant;
ler.HideMinorEntry = 0;
}
else
{
// The slice this is part of should only be displayed for lex entries with no ComplexEntryRefs.
Debug.Assert(ent.ComplexFormEntryRefs.Count() == 0);
//ler.ComplexEntryTypesRS.Append(ent.Cache.LangProject.LexDbOA.ComplexEntryTypesOA.PossibilitiesOS[0].Hvo);
ler.RefType = LexEntryRefTags.krtComplexForm;
ler.HideMinorEntry = 0; // LT-10928
// Logic similar to this is in EntrySequenceReferenceLauncher.AddNewObjectsToProperty()
// (when LER already exists so slice is not ghost)
ler.PrimaryLexemesRS.Add(newObj);
// Since it's a new LER, we can't know it to be a derivative, so by default it is visible.
// but do NOT do that here, it's now built into the process of adding it to PrimaryLexemes,
// and we don't want to do it twice.
// ler.ShowComplexFormsInRS.Add(newObj);
ent.ChangeRootToStem();
}
// Must do this AFTER setting the RefType (so dependent virtual properties can be updated properly)
ler.ComponentLexemesRS.Add(newObj);
});
}
catch (ArgumentException)
{
MessageBoxes.ReportLexEntryCircularReference((ILexEntry)m_obj, newObj, true);
}
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:63,代码来源:GhostLexRefSlice.cs
示例18: ReportLexEntryCircularReference
/// <summary>
/// Report failure to make target a component of parent. If startedFromComplex is true, the user is looking
/// at parent, and tried to make target a component. Otherwise, the user is looking at target, and
/// tried to make parent a complex form.
/// </summary>
public static void ReportLexEntryCircularReference(ILexEntry parent, ICmObject target, bool startedFromComplex)
{
var itemString = target is ILexEntry ? FwCoreDlgs.ksEntry : FwCoreDlgs.ksSense;
var msgTemplate = startedFromComplex ? FwCoreDlgs.ksComponentIsComponent : FwCoreDlgs.ksComplexFormIsComponent;
var startedFrom = startedFromComplex ? parent.HeadWord.Text : target.ShortName;
var msg = String.Format(msgTemplate, itemString, startedFrom);
MessageBox.Show(Form.ActiveForm, msg, FwCoreDlgs.ksWhichIsComponent, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:MessageBoxes.cs
示例19: PhoneEnvReferenceSlice
public PhoneEnvReferenceSlice(FdoCache cache, ICmObject obj, int flid,
XmlNode configurationNode, IPersistenceProvider persistenceProvider,
Mediator mediator, StringTable stringTbl)
: base(cache, obj, flid,configurationNode, persistenceProvider, mediator, stringTbl)
{
Debug.Assert(obj is MoAffixAllomorph || obj is MoStemAllomorph);
m_persistenceProvider = persistenceProvider;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:PhoneEnvReferenceSlice.cs
示例20: StFootnote
/// ------------------------------------------------------------------------------------
/// <summary>
/// Create a new (empty) StFootnote and add it to the owner's collection.
/// This method provides a way to create a new footnote object in the db for any generic
/// CmObject owner.
/// </summary>
/// <param name="owner">The owner CmObject.</param>
/// <param name="flid">The flid of the owner's footnote collection.</param>
/// <param name="footnoteIndex">Index to insert the footnote at in the collection.</param>
/// <returns>the new footnote object</returns>
/// ------------------------------------------------------------------------------------
public StFootnote(ICmObject owner, int flid, int footnoteIndex)
: this()
{
// add this new (empty) footnote to the owner's collection
FdoOwningSequence<IStFootnote> footnotes = new FdoOwningSequence<IStFootnote>(owner.Cache,
owner.Hvo, flid);
footnotes.InsertAt(this, footnoteIndex);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:StFootnote.cs
注:本文中的ICmObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论