我面临一个问题在SCSF.

我有两个工作区的

  1. MdiWorkspace
  2. DeckWorkspace

我有两个景观中的一个模块

  1. 观众(显示在mdiworkspace)
  2. 酒店观众(在deckworkspace)

在观众我有一个按钮在工具条,其目的是显示PropertyViewer(另一个图)。

我如何可以显示这PropertyViewer在deckworkspace抗按钮击事件。

注: 我没有命令使用[名称].AddInvoker(控制,"点击)和CommandHandler

有帮助吗?

解决方案

我会假设你的工具栏坐在一SmartPart实现MVP的模式。有按钮击事件的处理程序SmartPart火事件,其主持人会处理。你的主持人的代码这样的:

// Presenter code

protected override void OnViewSet()
{
   this.View.ToolbarButtonClick += View_ToolbarButtonClick;
}

public void View_ToolbarButtonClick(object sender, EventArgs e)
{
    // remove the handler so the property viewer 
    // will only be added the first time
    this.View.OnToolbarButtonClick -= View_ToolbarButtonClick;

    var propertyView = new PropertyViewer();
    this.WorkItem.Workspaces[WorkspaceNames.MyDeckWorkspace].Show(propertyView);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top