vb.net - NotifyIcon onClick event not firing -


could tell me why onclick event in code isn't working? else works. onclick event isn't! also, how can pass filename can used this:

   balloontiptext=filename 

code:

delegate sub invokedelegate()    public sub ondocumentsucceeded(filename string)     if not me.ishandlecreated       me.createhandle()     end if     invoke(new invokedelegate(addressof handle_ondocumentsucceeded))   end sub  public sub handle_ondocumentsucceeded()   notifyicon1.icon = systemicons.exclamation   notifyicon1.balloontiptitle = "your document has been generated"   'notifyicon1.balloontiptext = filename   notifyicon1.balloontiptext = "testing...."   notifyicon1.balloontipicon = tooltipicon.info   notifyicon1.visible = true   notifyicon1.showballoontip(5000)       end sub  private sub notifyicon1_mouseclick(sender object, e mouseeventargs) handles notifyicon1.mouseclick      messagebox.show("text clicked")      'this not working!!! end sub 

how solution this:

public class balloonnotifier      public shared sub showinfoballoon(byval title string, byval text string)         dim ni notifyicon = createnotification()         ni.icon = systemicons.exclamation         showballoon(ni, title, text)     end sub      public shared sub showfailballoon(byval title string, byval text string)         dim ni notifyicon = createnotification()         ni.icon = systemicons.error         showballoon(ni, title, text)     end sub      ' helper create new notifyicon     private shared function createnotification() notifyicon         dim notifyicon notifyicon = new notifyicon()          notifyicon.visible = true          ' assuming want handle both balloon being clicked , icon remains in tray.         addhandler notifyicon.balloontipclicked, addressof balloontipclicked         addhandler notifyicon.click, addressof balloontipclicked          return notifyicon     end function      private shared sub balloontipclicked(sender object, e eventargs)         dim notifyicon notifyicon = sender         messagebox.show(string.format("clicked on notifier document ""{0}""", notifyicon.balloontiptext))          ' lets hide balloon , icon after click         notifyicon.visible = false         notifyicon.balloontipicon = nothing         notifyicon.dispose()     end sub      private shared sub showballoon(byref notifyicon notifyicon, byval title string, byval text string)         notifyicon.visible = true         notifyicon.balloontiptext = text         notifyicon.balloontiptitle = title         notifyicon.showballoontip(5000)     end sub  end class 

then in form or wherever:

' delegates parameters     delegate sub ondocumentsucceeded(byval notification string, byval filename string)     delegate sub ondocumentfailed(byval notification string, byval filename string)      public sub documentsucceeded(byval filename string)         ' notify success         invoke(new ondocumentsucceeded(addressof balloonnotifier.showinfoballoon), "your file created!", filename)     end sub      public sub documentfailed(byval filename string)         ' notify fail         invoke(new ondocumentsucceeded(addressof balloonnotifier.showfailballoon), "creating document failed!", filename)     end sub 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -