本文整理匯總了VB.NET中System.Messaging.DefaultPropertiesToSend類的典型用法代碼示例。如果您正苦於以下問題:VB.NET DefaultPropertiesToSend類的具體用法?VB.NET DefaultPropertiesToSend怎麽用?VB.NET DefaultPropertiesToSend使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DefaultPropertiesToSend類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyNewQueue
' 導入命名空間
Imports System.Messaging
Public Class MyNewQueue
' Provides an entry point into the application.
'
' This example specifies different types of default
' properties for messages.
Public Shared Sub Main()
' Create a new instance of the class.
Dim myNewQueue As New MyNewQueue()
' Send normal and high priority messages.
myNewQueue.SendNormalPriorityMessages()
myNewQueue.SendHighPriorityMessages()
Return
End Sub
' Associates selected message property values
' with high priority messages.
Public Sub SendHighPriorityMessages()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Associate selected default property values with high
' priority messages.
myQueue.DefaultPropertiesToSend.Priority = _
MessagePriority.High
myQueue.DefaultPropertiesToSend.Label = _
"High Priority Message"
myQueue.DefaultPropertiesToSend.Recoverable = True
myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
New TimeSpan(0, 0, 30)
' Send messages using these defaults.
myQueue.Send("High priority message data 1.")
myQueue.Send("High priority message data 2.")
myQueue.Send("High priority message data 3.")
Return
End Sub
' Associates selected message property values
' with normal priority messages.
Public Sub SendNormalPriorityMessages()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Associate selected default property values with normal
' priority messages.
myQueue.DefaultPropertiesToSend.Priority = _
MessagePriority.Normal
myQueue.DefaultPropertiesToSend.Label = _
"Normal Priority Message"
myQueue.DefaultPropertiesToSend.Recoverable = False
myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
New TimeSpan(0, 2, 0)
' Send messages using these defaults.
myQueue.Send("Normal priority message data 1.")
myQueue.Send("Normal priority message data 2.")
myQueue.Send("Normal priority message data 3.")
Return
End Sub
End Class