本文整理汇总了C#中XCore.Mediator.AddTemporaryColleague方法的典型用法代码示例。如果您正苦于以下问题:C# Mediator.AddTemporaryColleague方法的具体用法?C# Mediator.AddTemporaryColleague怎么用?C# Mediator.AddTemporaryColleague使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCore.Mediator
的用法示例。
在下文中一共展示了Mediator.AddTemporaryColleague方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCtrlClick
/// <summary>
/// Handle a control-click by invoking the first active JumpToTool menu item.
/// Note that the item selected here should be the same one that is selected by Mark
/// </summary>
/// <param name="mediator"></param>
/// <param name="hostControl"></param>
/// <returns></returns>
public bool HandleCtrlClick(Mediator mediator, Control hostControl)
{
Mediator = mediator;
var window = (XWindow)mediator.PropertyTable.GetValue("window");
m_hostControl = hostControl;
var group = window.GetChoiceGroupForMenu(ContextMenuId);
// temporarily the CmObjectUi must function as a colleague that can implement commands.
mediator.AddTemporaryColleague(this);
group.PopulateNow();
try
{
foreach (var item in group)
{
if (!IsCtrlClickItem(item))
continue;
((CommandChoice)item).OnClick(this, new EventArgs());
return true;
}
}
finally
{
Dispose();
}
return false;
}