Results 1 to 2 of 2

Thread: i need help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    1

    Exclamation i need help

    Hello
    Anyone can help me with this problem?

    Code:
    Imports Microsoft.VisualBasic
    
    Imports System
    Imports System.Web
    Imports BlogEngine.Core.Web.Controls
    Imports BlogEngine.Core
    Imports System.Net.Mail
    Imports System.Threading
    
    <Extension("Pings all the ping services specified on the PingServices admin page and send track- and pingbacks", "1.3", "Blog")> _
    Public Class SendPings
        Shared Sub New()
            AddHandler Post.Saved, AddressOf Post_Saved
            AddHandler Page.Saved, AddressOf Post_Saved
        End Sub
    
        Private Shared Sub Post_Saved(ByVal sender As Object, ByVal e As SavedEventArgs)
            If e.Action = SaveAction.None OrElse e.Action = SaveAction.Delete Then
                Exit Sub
            End If
    
            Dim item As IPublishable = DirectCast(sender, IPublishable)
            If item.IsVisibleToPublic Then
                Dim url As Uri = item.AbsoluteLink
                   ThreadPool.QueueUserWorkItem(AddressOf Ping, item)
            End If
          
        End Sub
    
        Private Shared Sub Ping(ByVal item As IPublishable, ByVal itemUrl As Uri)
            Try
                System.Threading.Thread.Sleep(2000)
    
                ' Ping the specified ping services.
                BlogEngine.Core.Ping.PingService.Send(itemUrl)
    
                ' Send trackbacks and pingbacks.
                If Not BlogSettings.Instance.EnableTrackBackSend AndAlso Not BlogSettings.Instance.EnablePingBackSend Then
                    Exit Sub
                End If
    
                If item.Content.ToUpperInvariant().Contains("""HTTP") Then
                    BlogEngine.Core.Ping.Manager.Send(item, itemUrl)
                End If
            Catch generatedExceptionName As Exception
                ' We need to catch this exception so the application doesn't get killed.
            End Try
        End Sub
    
    End Class
    the problem is this
    Method 'Private Shared Sub Ping(item As BlogEngine.Core.IPublishable, itemUrl As System.Uri)' does not have a signature compatible with delegate 'Delegate Sub WaitCallback(state As Object)'.

    please help me

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: i need help

    The signature of your Ping method must match the WaitCallback delegate if you want to use it with the QueueUserWorkItem function, that is, it must take only 1 argument of type Object:
    Code:
    Private Shared Sub Ping(ByVal state as Object)
    ' ....
    End Sub
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width