End Google Ads 201810 - BS.net 01 --> On the server side I have:
SolutionGlobals.csproj
public class EventHandling
{
public static int EventUserID;
public delegate void TimedOutEventHandler(TimedOutEventArgs e);
public static event TimedOutEventHandler TimedOut;

public static void OnTimedOut()
{
if (TimedOut != null)
{
TimedOut(new TimedOutEventArgs(EventHandling.EventUserID));
}
}
}
public class TimedOutEventArgs : EventArgs
{
private int m_userID;

public TimedOutEventArgs(int userID)
{
m_userID = userID;
}

public int userID
{
get { return m_userID; }
}
}
DataAccess.csproj
public class DataAccess : MarshalByRefObject
{
...
public static void IncrementOnlineCount()
{
...
if ((int)r["OnlineCount"] >= 5)
{
r["OnlineCount"] = 0; // This line works
r["Online"] = 0; // This line works
EventHandling.EventUserID = (int)r["UserID"];
EventHandling.OnTimedOut(); // Not sure if event is raised
}
...
}
...
}


On the client side I have:
public partial class Office : Form
{
public Office()
{
...
// Subscribe to event
EventHandling.TimedOut += new EventHandling.TimedOutEventHandler(TimedOutRaised);
...
}
private void TimedOutRaised(TimedOutEventArgs e)
{
if (e.userID == UserID) // Breakpoint placed here
{
MessageBox.Show("You have timed out!!!",
"Alert",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
}

By checking the values in the database I can see OnlineCount go from 0 to 1 to 2 ... to 4 and then back to 0, so r["OnlineCount"] = 0; works, but a breakpoint in TimeOutRaised shows it is never called. What am I missing?