I have created an application that uses 3 parts: 1) a windows service
that distributes email 2) a form that configures the settings
(incoming address, outgoing address, etc) for that service and 3) a
form that acts as a report for how that service is doing (emails sent,
etc).
I want the report form (3) to be updated real time with the service's
progress. Right now I'm using the Singleton pattern for storing the
settings & data that the service uses (as it sends an email it updates
that iEmailsSent variable of that singleton. I read that static
variables are created once per namespace so I have renamed all the
projects to a single namespace so that they can share those static
variables. Now I figure that as the service performs its duties, I
should be able to see the results of those in real time via my report
form by just referencing that Singleton settings object, since that is
a static variable that should exist to all three of these projects
simultaniously.
However, when I test this (I have a windows form that does the same
thing as the service for debugging purposes) I open the service tester
form in debug mode and run it so that it sends a few email and updates
the Singleton variable, then while that's still open I open my report
which should be reading from that same static instance and it doesn't
see any of the info -- they're not "sharing".
Should this work and I just need to debug? Is the problem that I'm
running one in VS debug mode and one in native windows? Is there
something fundamentally wrong with the way I'm doing this? Is there
something I'm missing?
Thanks,
Noah