Windows Service for Reminder/Alarm

  • Thread starter Thread starter Phil G.
  • Start date Start date
P

Phil G.

Hi all,

I would like to create a very simple 'lite' version of Outlook Calendar's
reminder function. I will use a windows service that will read timedate
stamps from a db and compare them to Now. This seems that it will create a
lot of processor overhead in terms of 'how often shall I check the db?'. I
wonder if I check it hourly and save additional info. as a timespan...I just
don't know......has anyone got any ideas of best practice for this sort of
thing?

Thanks in advance.

Phil
 
How often do new things get added to the DB?

I would suggest that you only read from the DB when you know there are new
things to read in, then once the things are read in keep the list in memory
and simply track times.
 
Hi Ray,

The 'notes' will be added manually by the user and it will be as-and-when.
The db will be held on the local machine and it will probably be switched
on/off daily. So, are you perhaps suggesting a check of the db on startup,
any reminders for that day would then be held in memory under a timespan? I
haven't done much in this area! Would I need to use callback methods? Would
this involve multiple threads if there is more than one reminder for that
day? You state to 'keep the list in memory'...how?

Thanks for your help/input.

Cheers, Phil
 
My suggestion would be to have a FileSystemWatcher in your service. Have it
watch for LastWriteTime, and trigger your routines on that.

Keep the list in memory by keeping it in a DataTable or maybe an ArrayList.
 
Hi Terry,

Do you ever get the feeling that everyone else is on the same page and
you're someone in the foreword! :-)

I am starting to feel lost! So, I have this datatable or arraylist. Such an
object holds the data, in this case a time and date. I must still be
'tracking' the next or 1st time/date from the current time. What is the
correct method of doing this tracking and how will I fire an event when
current time = time in one of my datatable records?

Sorry if I am now sounding dumb!!!
 
Phil,
In addition to the other comments.

Have you considered using SQL Notification Services to have your app
notified when changes are made to the database?

http://www.microsoft.com/sql/technologies/notification/default.mspx


When you app starts it could determine when the next event occurs & wait for
the event. If a table change occurs before the event, the service could wake
up (due to the notification services) and recalculate when the next event
occurs.

I know .NET 2.0 has some support for SQL Notification Services, however I'm
not sure how much is exposed for your Windows Service to leverage them...
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Hi all,
|
| I would like to create a very simple 'lite' version of Outlook Calendar's
| reminder function. I will use a windows service that will read timedate
| stamps from a db and compare them to Now. This seems that it will create a
| lot of processor overhead in terms of 'how often shall I check the db?'. I
| wonder if I check it hourly and save additional info. as a timespan...I
just
| don't know......has anyone got any ideas of best practice for this sort of
| thing?
|
| Thanks in advance.
|
| Phil
|
|
 
Maybe something like this.

Create a Item class that contains all the details you need about your
'thing' in the database. This would probably have something like date and
time of the note, reminder time(in case you want to remind in advance like
Outlook does), and item description and a index to the DB so you can do a
look up. Each Item class will raise an event with it's time is up.

Create a controller class that reads the DB, grabs each note and builds a
separate instance of the Item class then creates a thread for each item that
will track the time tracking. The controller would get the events form each
Item instance and then use them to populate a dialog box (not sure if you
plan to do a GUI or not) like Outlook does to show the reminder. If no GUI
(take care if you want to show a GUI from a service here - you should do the
GUI as a separate app) you can just use this to trigger another
thread/process to act on what you want done at that time.

It's not difficult, just a bit time consuming and really not a beginner
task. There was actually a good article in last months Visual Studio
Magazine that would help you out here.

http://www.ftponline.com/vsm/2005_10/magazine/columns/desktopdeveloper/
 
Thanks Ray, seems like I can work through (.............I think :-) your
suggestion. At least I get the general gist. I have also just registered on
ftponline and will read the rest of the article that you provided a link to.
Thanks for that.

Best regards.

Phil
 
Hi Jay,

.....NO! :-)...

Actually, I have limited experience with SQL in as much as I can create SQL
db's, write/read etc however I am but a poor vb.net hobbyist :-) I don't
have 2005 and only use 2003 with the 1.1 Framework.....perhaps a little over
my head at this point!

Thanks for your comments.

Regards, Phil
 
Phil,
VS 2003, .NET 1.1, and SQL Server 200, and I believe SQL Server 7.0 also
have access to SQL Notification Services ;-)

SQL Server 2005 just adds some new & expanded features to the mix!

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Hi Jay,
|
| ....NO! :-)...
|
| Actually, I have limited experience with SQL in as much as I can create
SQL
| db's, write/read etc however I am but a poor vb.net hobbyist :-) I don't
| have 2005 and only use 2003 with the 1.1 Framework.....perhaps a little
over
| my head at this point!
|
| Thanks for your comments.
|
| Regards, Phil
|
| message | > Phil,
| > In addition to the other comments.
| >
| > Have you considered using SQL Notification Services to have your app
| > notified when changes are made to the database?
| >
| > http://www.microsoft.com/sql/technologies/notification/default.mspx
| >
| >
| > When you app starts it could determine when the next event occurs & wait
| > for
| > the event. If a table change occurs before the event, the service could
| > wake
| > up (due to the notification services) and recalculate when the next
event
| > occurs.
| >
| > I know .NET 2.0 has some support for SQL Notification Services, however
| > I'm
| > not sure how much is exposed for your Windows Service to leverage
them...
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > | > | Hi all,
| > |
| > | I would like to create a very simple 'lite' version of Outlook
| > Calendar's
| > | reminder function. I will use a windows service that will read
timedate
| > | stamps from a db and compare them to Now. This seems that it will
create
| > a
| > | lot of processor overhead in terms of 'how often shall I check the
db?'.
| > I
| > | wonder if I check it hourly and save additional info. as a
timespan...I
| > just
| > | don't know......has anyone got any ideas of best practice for this
sort
| > of
| > | thing?
| > |
| > | Thanks in advance.
| > |
| > | Phil
| > |
| > |
| >
| >
|
|
 
Back
Top