I call AddSimpleVehicleMarkers event to display markers on the Map. When I work with project there is no problem on my pc but when I deploy it to the server it shows me the markers when the page is loaded but when the time interval is arrived make them invisible.
Server : Windows Server 2008 R2 Enterprise 64bit turkish
My Pc : Windows 7 64bit turkish,visual studio 2008.
protected void Page_Load(object sender, EventArgs e)
{
...
...
...
SimpleMarkerOverlay smMarkerOverlay = new SimpleMarkerOverlay("Vehicles");
smMarkerOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(interval);
smMarkerOverlay.Tick += new EventHandler<EventArgs>(AddSimpleVehicleMarkers);
Map1.CustomOverlays.Add(smMarkerOverlay);
AddSimpleVehicleMarkers(this.Page,e);
}
void AddSimpleVehicleMarkers(object sender, EventArgs e)
{
List<double> lx = new List<double>();
List<double> ly = new List<double>();
GetVehicleData(rid == 0 ? currentFleet : 0, rid, userid, filter, groupId, HatId);
SimpleMarkerOverlay smMarkerOverlay = (SimpleMarkerOverlay)Map1.CustomOverlays["Vehicles"];
smMarkerOverlay.Markers.Clear();
Map1.Popups.Clear();
for (int i = 0; i < staticDt.Rows.Count; i++)
if ((Convert.ToDouble(staticDt.Rows[i]["X"].ToString()) != 0) && (Convert.ToDouble(staticDt.Rows[i]["Y"].ToString()) != 0))
{
string uid = staticDt.Rows[i]["CIHAZID"].ToString();
string plaka = staticDt.Rows[i]["PLAKA"].ToString();
string hiz = staticDt.Rows[i]["SPEED"].ToString();
string tarih = staticDt.Rows[i]["DATE"].ToString();
string adres = HttpContext.Current.Server.HtmlEncode(staticDt.Rows[i]["LOCATION"].ToString());
double xCoord = 0;
double.TryParse(staticDt.Rows[i]["X"].ToString(), out xCoord);
double yCoord = 0;
double aci = 0;
double.TryParse(staticDt.Rows[i]["DIRECTION"].ToString(), out aci);
double.TryParse(staticDt.Rows[i]["Y"].ToString(), out yCoord);
int kontak = (int)staticDt.Rows[i]["KONTAK"];
int aractip = (int)staticDt.Rows[i]["ARACTIPID"];
bool rolanti = (bool)staticDt.Rows[i]["ROLANTI"];
bool status = Convert.ToInt32(staticDt.Rows[i]["STATUS"]) != 0;
int imgH = 0, imgW = 0;
DateTime InsertDate = Convert.ToDateTime(staticDt.Rows[i]["INSERTDATE"].ToString());
int iStatus = 0;
TimeSpan tm = DateTime.Now - InsertDate;
if ((!status) && (tm.TotalMinutes >= 60))
{
iStatus = 4;
}
else
{
if (kontak == 1 && !rolanti) iStatus = 1;
else if (kontak == 1 && rolanti) iStatus = 2;
else if (kontak == 0) iStatus = 3;
}
string vStatus = String.Format("{0:000}", iStatus);
string vFolder = (aractip > 0) ? aractip.ToString() + "/" : "";
string imagePath = String.Format("images/vTypes/{0}{1}.gif", vFolder, vStatus);
Vertex v = MapGlobals.ConvertCoord(xCoord, yCoord, true);
lx.Add(v.X);
ly.Add(v.Y);
Marker vm = new Marker(v.X, v.Y);
vm.WebImage = new WebImage(imagePath, 15,15 );
vm.Popup = GetPopupStyle(uid, plaka, hiz, adres, tarih);
vm.Popup.HasCloseButton = false;
vm.Popup.IsVisible = false;
smMarkerOverlay.Markers.Add(vm);
}
}
lx.Sort();
ly.Sort();
if (lx.Count > 0)
{
double x1 = lx[0];
double y1 = ly[0];
double x2 = lx.Last<double>();
double y2 = ly.Last<double>();
if (!IsPostBack)
{
if (!useKmlFile)
{
Map1.CurrentExtent = ExtentHelper.GetDrawingExtent(new RectangleShape(x1, y2, x2, y1), Convert.ToSingle(Map1.Width.Value), Convert.ToSingle(Map1.Height.Value));
double CurrentScale = ExtentHelper.GetScale(new RectangleShape(x1, y2, x2, y1), Convert.ToSingle(Map1.Width.Value), Map1.MapUnit);
if (CurrentScale > 1004000)
{
PointShape point = Map1.CurrentExtent.GetCenterPoint();
Map1.ZoomTo(point, Map1.ClientZoomLevelScales[1]);
}
}
}
}
}
Thanks,
Ayhan