Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have filewatcher in windows service OnStart method to look for particular directory or folder path and process files... blah blah blah.... This path I am reading from other application and it works well.

I start my windows service and it all works well. However, after sometime, if path has changed from user, how would I achieve to send this new path to file watcher in windows service without stopping the service?

Thanks !
Posted
Comments
Sergey Alexandrovich Kryukov 18-Aug-14 18:45pm    
Answering: change the path and blah-blah-blah. Got the hint?

More seriously, there is no such thing as "send to file watcher". It just handles the events.

—SA
[no name] 18-Aug-14 18:59pm    
You would need to implement some sort of IPC.
himanshu agarwal 20-Aug-14 7:24am    
If the user/client is making modifications via your application then you may implement a custom service command to notify your service of the change.

Got the solution,... I have just used a timer in my Start event of windows which will call particular method in specific interval, and in that I am checking my updated path.

Private timer As New Timer()

Protected Overrides Sub OnStart(ByVal args() As String)
AddHandler timer.Elapsed, AddressOf Path_Changed
timer.Interval = 10000
timer.AutoReset = True
timer.Enabled = True
timer.Start()
End Sub

Private Sub Path_Changed(sender As Object, e As EventArgs)
Dim GeneralSettings As New Dictionary(Of String, Object)
Dim myClientSettings As New My_WCFService.MyService
GeneralSettings = myClientSettings.GetMyClientSettings()
FSWatcher.Path = GeneralSettings("InputFolder")
End Sub
 
Share this answer
 
Thanks All for your help !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900