Hi This code snippet was converted from the c# snippet on this link :
A ChildWindow management service for MVVM applications
There are two classes in this snippet first is my confirmessage class
Public Class ConfirmMessage
''' <summary>
''' Initializes a new instance of the <see cref="ConfirmMessage"/> class.
''' </summary>
''' <param name="message">The message.</param>
''' <param name="callback">The callback.</param>
Public Sub New(ByVal message As String, ByVal callback As Action(Of Boolean?))
Me.Message = message
Me.Callback = callback
End Sub
Public Property Callback() As Action(Of Boolean?)
Get
Return m_CallBack
End Get
Set(ByVal value As Action(Of Boolean?))
m_CallBack = value
End Set
End Property
Private m_CallBack As Action(Of Boolean?)
''' <summary>
''' Gets or sets the message.
''' </summary>
''' <value>The message.</value>
Public Property Message() As String
Get
Return m_Message
End Get
Set(ByVal value As String)
m_Message = value
End Set
End Property
Private m_Message As String
End Class
then In my Service I am doing this
'ConfirmDialog is a Childwindow
Public Sub ShowConfirmDialog(ByVal message As ConfirmMessage)
Dim dialog As New ConfirmDialog() 'reference to the childwindow we want to display
dialog.Message = message.Message
AddHandler dialog.Closed, Sub(s, e) message.Callback(dialog.DialogResult)
dialog.Show()
End Sub
Now this works fine in C# , however in vb,net the line where I add the event handler generates the following error on the message.callback property : Property access must assign to the property or use its value
I am tearing out my hair on this I have never used the Action of T delegate before so could i be missing something simeple ? I can provide the c# code as well.
thanks in advance.
A ChildWindow management service for MVVM applications
There are two classes in this snippet first is my confirmessage class
Public Class ConfirmMessage
''' <summary>
''' Initializes a new instance of the <see cref="ConfirmMessage"/> class.
''' </summary>
''' <param name="message">The message.</param>
''' <param name="callback">The callback.</param>
Public Sub New(ByVal message As String, ByVal callback As Action(Of Boolean?))
Me.Message = message
Me.Callback = callback
End Sub
Public Property Callback() As Action(Of Boolean?)
Get
Return m_CallBack
End Get
Set(ByVal value As Action(Of Boolean?))
m_CallBack = value
End Set
End Property
Private m_CallBack As Action(Of Boolean?)
''' <summary>
''' Gets or sets the message.
''' </summary>
''' <value>The message.</value>
Public Property Message() As String
Get
Return m_Message
End Get
Set(ByVal value As String)
m_Message = value
End Set
End Property
Private m_Message As String
End Class
then In my Service I am doing this
'ConfirmDialog is a Childwindow
Public Sub ShowConfirmDialog(ByVal message As ConfirmMessage)
Dim dialog As New ConfirmDialog() 'reference to the childwindow we want to display
dialog.Message = message.Message
AddHandler dialog.Closed, Sub(s, e) message.Callback(dialog.DialogResult)
dialog.Show()
End Sub
Now this works fine in C# , however in vb,net the line where I add the event handler generates the following error on the message.callback property : Property access must assign to the property or use its value
I am tearing out my hair on this I have never used the Action of T delegate before so could i be missing something simeple ? I can provide the c# code as well.
thanks in advance.