Microsoft Composite Application Block(CAB)加载问题

时间:2014-03-10 21:21:39

标签: asp.net-mvc vb.net publish-subscribe cab composite-application

我是微软CAB框架的新手,我遇到了一个问题,我无法“取消隐藏”应用程序中的功能区,因为它是在应用程序加载时设置的。我可以在WorkItem控制器中的事件中取消隐藏/显示它,如下所示:

' Show Ribbon
<EventSubscription(Constants.Events.HideRibbon, ThreadOption.UserInterface)> _
Public Sub hideRibbon(ByVal sender As Object, ByVal e As EventArgs)
    mShellUIExtensionService.ShowRibbon(True)
End Sub

我以为我可以从启动时加载的视图中发布上述事件,但是在应用程序启动后仍然隐藏了功能区栏。

我公司的某个人正在使用以下hack将“来自”ShellCreated“事件的F1密钥发送给应用程序(我相信这是一个保留字事件,因为我可以在代码中的任何地方找到事件发布),但我发现它有时会将F1键发送到错误的应用程序,如Word,Outlook等:

'This works, kind of...    
'===Maximize the RibbonBar automatically on Startup===
<EventSubscription("ShellCreated", ThreadOption.UserInterface)> _
Public Sub OnShellCreated(ByVal sender As Object, ByVal e As EventArgs)
    System.Windows.Forms.SendKeys.Send("^{F1}")


End Sub

我尝试将mShellUIExtensionService.ShowRibbon(True)添加到上面的OnShellCreated函数中,但功能区仍保持隐藏状态。

我怀疑问题在于加载CAB架构的顺序,所以是否有人知道在加载应用程序后如何设置由CAB加载的属性?或者至少知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

通过反复试验,我发现以下内容有效:

<EventSubscription("ShellCreated", ThreadOption.UserInterface)> _ 
Public Sub OnShellCreated(ByVal sender As Object, ByVal e As EventArgs)
    mShellUIExtensionService.RibbonBar.IsMinimized() = False
End Sub