Refresh Map to Update PointLayer

Aug 7, 2009 at 6:46 PM
Edited Aug 7, 2009 at 6:50 PM

I have a layer that displays sites as either a red circle(alarm state) or a green circle(normal state).  I'm trying to simulate an alarm going off at a site and I need to refresh the map without any user input so it matches the DB. 

Currently I'm trying to use:  

SharpMap_BeginRefreshMap(ctl00_MainContent_ajaxMapObj,1);

This definitely does something but I don't think it's doing what I want. 

I need to call a server side function to update the database before I refresh the map so I was using the ICallbackEventHandler and a javascript timer:

setInterval("CallServer('refresh')",10000)

This would cause the program to crash and after some source code investigation the BeginRefreshMap uses a callback as well.  Somehow this got me into an infinite loop.

 

Here is some pertient code:

Default.aspx

 
function timedrefresh()
{
 //it will referesh only map after 10 sec  
setInterval("CallServer('refresh')",10000); 
}

 

function ReceiveServerData(result, context) 
{
if(result == "refresh" 
) 
{

SharpMap_BeginRefreshMap(ctl00_MainContent_ajaxMapObj,1);

}


Default.aspx.cs


 ClientScript.RegisterStartupScript(this.GetType(), "timer", "");  <<< in page load function

 public string GetCallbackResult() 
{
return gridHTML; 
}

 
public void RaiseCallbackEvent(string eventArgument) 
{
 
gridHTML = ""; 
 
if (eventArgument == "refresh") 
{

mc.updateSiteStatus();  < 
gridHTML ="refresh"; 
}


 

}

I am using the latest v1 code from the svn trunk.  Please let me know if you see any issues or insight on how to do this update correctly.