本文整理汇总了C#中IEventAggregator.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IEventAggregator.SendMessage方法的具体用法?C# IEventAggregator.SendMessage怎么用?C# IEventAggregator.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventAggregator
的用法示例。
在下文中一共展示了IEventAggregator.SendMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoryTellerTabItem
public StoryTellerTabItem(IScreen screen, IEventAggregator events)
{
_screen = screen;
_item = new TabItem();
Func<Action<IScreenConductor>, Action> sendMessage = a => () => events.SendMessage(a);
_item.Header = new StackPanel().Horizontal()
.Configure(x =>
{
x.Height = 25;
})
.AddText(screen.Title, x => _label = x)
.Add(new TabCloser(sendMessage(s => s.Close(screen))));
_label.VerticalAlignment = VerticalAlignment.Center;
_label.Margin = new Thickness(0, 0, 5, 0);
_item.Content = new DockPanel().With(screen.View);
_item.Tag = screen;
// Sets up a context menu for each tab in the screen that can capture "Close"
// messages
_item.ContextMenu = new ContextMenu().Configure(o =>
{
o.AddItem("Close", sendMessage(s => s.Close(screen)));
o.AddItem("Close All But This", sendMessage(s => s.CloseAllBut(screen)));
o.AddItem("Close All", sendMessage(s => s.CloseAll()));
});
}
示例2: ScreenCollection
public ScreenCollection(TabControl tabs, IEventAggregator events)
{
_tabs = tabs;
_tabItems.OnMissing = screen => new StoryTellerTabItem(screen, events);
// Sends a message when the user select a different tab on the screen
_tabs.SelectionChanged += (s, c) => events.SendMessage<UserScreenActivation>();
}
示例3: ScreenCollection
public ScreenCollection(TabControl tabs, IEventAggregator events)
{
_tabs = tabs;
_tabItems.OnMissing = screen => new StoryTellerTabItem(screen, events);
// Sends a message when the user select a different tab on the screen
_tabs.SelectionChanged += (s, c) => events.SendMessage<UserScreenActivation>();
// Hack. Sigh.
events.AddListener(new RenameTestHandler(new ScreenFinder(this), this));
}
示例4: StoryTellerTabItem
public StoryTellerTabItem(IScreen screen, IEventAggregator events)
{
Func<Action<IScreenConductor>, Action> sendMessage = a => () => events.SendMessage(a);
Header = new StackPanel().Horizontal()
.AddText(screen.Title, x => _label = x)
.IconButton(Icon.Close, sendMessage(s => s.Close(screen)), b => b.SmallerImages());
Content = new DockPanel().With(screen.View);
Tag = screen;
// Sets up a context menu for each tab in the screen that can capture "Close"
// messages
ContextMenu = new ContextMenu().Configure(o =>
{
o.AddItem("Close", sendMessage(s => s.Close(screen)));
o.AddItem("Close All But This", sendMessage(s => s.CloseAllBut(screen)));
o.AddItem("Close All", sendMessage(s => s.CloseAll()));
});
}