【发布时间】:2014-02-03 03:05:16
【问题描述】:
outlook PropertyPage 接口需要只读布尔属性 Dirty。
当设置为true 时,属性页选项对话框中的应用按钮将变为启用状态。
根据这个walkthrough,你必须调用OnStatusChange来通知UIDirty的值发生了变化。
据称,这可以通过调用以下方式获得:
Dim ppSite As Outlook.PropertyPageSite = Parent
ppSite.OnStatusChange()
但是Parent 总是什么都不返回,所以我没有机制告诉 UI 何时我更新了脏标志。
我该怎么做?
我正在使用此discussion 中生成的基本步骤来设置选项页面。
这是我的代码的完整实现:
添加了名为SendReminderOptions的新用户控件:
<ComVisible(True)>
Public Class SendReminderOptions : Inherits UserControl : Implements Outlook.PropertyPage
Const captionDispID As Integer = -518
Private _dirty As Boolean = False
Public ReadOnly Property Dirty As Boolean Implements Microsoft.Office.Interop.Outlook.PropertyPage.Dirty
Get
Return _dirty
End Get
End Property
Public Sub SetDirty(newValue As Boolean)
_dirty = newValue
Dim ppSite As Outlook.PropertyPageSite = Parent
ppSite.OnStatusChange()
End Sub
<DispId(captionDispID)> _
Public ReadOnly Property PageCaption() As String
Get
Return "Send Reminder Options"
End Get
End Property
Public Sub GetPageInfo(ByRef HelpFile As String, ByRef HelpContext As Integer) Implements Microsoft.Office.Interop.Outlook.PropertyPage.GetPageInfo
End Sub
Public Sub Apply() Implements Microsoft.Office.Interop.Outlook.PropertyPage.Apply
End Sub
End Class
将以下代码添加到ThisAddIn
Private Sub ThisAddIn_Startup() Handles Me.Startup
Dim myOutlook As Outlook.Application = Globals.ThisAddIn.Application
AddHandler myOutlook.OptionsPagesAdd, AddressOf AddOptionsPage
End Sub
Private Sub AddOptionsPage(ByVal pages As PropertyPages)
pages.Add(New SendReminderOptions(), "Options")
End Sub
【问题讨论】:
标签: .net vb.net outlook vsto outlook-addin