You need to Register for free and Login to post a message in the forum.

Forum

Subject: FileSystemWatcher Problem
Prev Next
You are not authorized to post a reply.

Author Messages
ALEXw
Nuker
Nuker
Posts:19

02 May 2008 5:44 AM  
Hi,
I'm creating a module which waits for XML files to appear in a directory. The problem I have is......it just wont work. Here is the code, can anyone help?

Imports DotNetNuke

Imports System.Web.UI

Imports System.Collections.Generic

Imports System.Reflection

Imports DotNetNuke.Security.PortalSecurity

Imports Microsoft.VisualBasic.ControlChars

Imports System.Xml

Imports System.IO

Imports System.Diagnostics

 

 

Namespace DotNetNuke.Modules.XMLFileSearch

    Public Class XMLFileSearch

        Inherits Entities.Modules.PortalModuleBase

      

        Protected Sub Page_Load(ByVal sender As System.Object, _

                  ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load

            If IsInRole("Registered Users") Or _

               IsInRole("Administrators") Then

 

                Run()

            Else

                'Add code here

            End If

        End Sub

 

        Private Shared Sub Run()

            ' Create a new FileSystemWatcher and set its properties.

            Dim watcher As New FileSystemWatcher()

            watcher.Path = "C:\XML"

            ' Watch for changes in LastAccess and LastWrite times, and

            ' the renaming of files or directories. Add all notify filters until it works then remove

            watcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName Or NotifyFilters.CreationTime)

            ' Only watch xml files.

            watcher.Filter = "*.xml"

            ' Add event handlers.

‘Use watcher.changed to see if code works. Remove when working.

            AddHandler watcher.Changed, AddressOf OnChanged

            AddHandler watcher.Created, AddressOf OnChanged

            ' Begin watching.

            watcher.EnableRaisingEvents = True

 

        End Sub

 

        Public Shared Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)

            ' Specify what is done when a file is changed, created, or deleted.

            Dim label2 As New Label

            label2.BackColor = Color.Green

            label2.Text = "File received....."

 

‘Process the file. Code below

 

 

‘Change label3 text to processed

Dim label3 As New Label

            Label3.BackColor = Color.Green

            Label3.Text = "File Processed"

 

        End Sub

 

    End Class

 

End Namespace

You are not authorized to post a reply.
Forums > DotNetNuke® > Modules > FileSystemWatcher Problem



ActiveForums 3.7

Latest Forum Posts

RE: Keep Testing Skins by ollep
Some details re Logo possition: HTML:div class="header">p>[LOGO]p>div>Found possitioning in "index_...
Pathing issues after setting up a domain name by harlowj
I had a site configured here: http://www.autorotate.com/portal/chl (all works good)I then decided to...
RE: Keep Testing Skins by ollep
Hi Lee – and Joe   I’m Using DNN 4.5.5   I just installed Summer Breeze Skin and Template, and a...
RE: DNN - web services not working by jncraig
Do your web services have their own config files? Are they located in actual directories below the ...
RE: Installation on Vista by jncraig
You install Visual Studio according to the installation instructions. Once installed, you can "open...
Installation on Vista by jesp17
I followed the how to install DNN to Vista, but what I miss is the intallation of visual studio. Can...
RE: Building a website with DNN by freedom22
Hi Lee, Thanks for getting back to me. I understand now what you are saying, but I am still confuse...
RE: How to limit access to the admin menu.... by tallorder
Hi Lee Unfortunately I can't see how it works in reverse because the original process involved movi...
RE: Building a website with DNN by leesykes
Hello,Those classes refer to the menu, and therefore will not be specified in your skin.htm file as ...
RE: [HOUSEMENU] token not working by leesykes
Glad you sorted it, thanks,
RE: [HOUSEMENU] token not working by whred5
OK I fixed myself after googling the problem. If anyone else comes across this situation you need t...
DNN - web services not working by paulrobinson
Good Afternoon,Please help.  I have just installed my DNN web site to my dedicated live host machine...
[HOUSEMENU] token not working by whred5
HiI have been playing around with the Lazy_Days skin in an effort to learn css based skinning, I hav...
RE: Building a website with DNN by freedom22
Lee or Joe, I meant that the skin.css file I downloaded has classes like .main_dnnmenu_item td w...
RE: Building a website with DNN by freedom22
Lee, thanks for your reply. I did find the files. I am going through your tutorail, and in video7...
RE: page publish date by leesykes
I would suggest you view these tutorials:User Accounts new features User Accounts and User Settings ...
RE: page publish date by jncraig
I'm not quite sure that I understand you, but ... on the user accounts page there are these options:...
RE: Best so far for me by jncraig
I like the Snapsis CSS Nav Menu. You'll find it at Snapsis.com.
RE: How to limit access to the admin menu.... by leesykes
Hello,Simply reverse the process, you can copy the settings from one of the other admin menu items t...
RE: How to limit access to the admin menu.... by tallorder
Shame about the parent page drop down being grey out since any Site Administrator is going to want t...
DotNetNuke Modules
RSS Feeds