Hello.
In Map 3D the data uses from Oracle by means of FDO connection. The system is oriented to cooperative work, so we Need to update changes made by all network users automatically.
If we use the code below and call it manually with the command, then, usually, everything works OK.
[CommandMethod("MANREFRESH")]
public void man_refresh()
{
AcMapMap currentMap = AcMapMap.GetCurrentMap();
MgLayerCollection LayerCol = currentMap.GetLayers();
for (int i = 0; i < LayerCol.Count; i++)
{
MgLayerBase currentLayer = LayerCol.GetItem(i);
currentLayer.ForceRefresh();
}
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen();
}
But if we run the same code from a dll by timer or by notification in socket, then we get the error:
>> System.NullReferenceException: Object reference not set to an instance of the object.
If we remove Regen (), we get a blank window witgout any objects after the update happens. In this case objects can be returned manually by right-clicking on Oracle layers and selecting "Update layer."
Do anyone know how could this issue be resolved? Or may there be any other ways to make layers refreshing?
Hello
I am not a programmer, so ...
If you want to update all the FDO layers, you could use the MAPUPDATEMAP command !
Bye, Pat
Patrice BRAUD
Howdy,
Version??
How/when is the dll that contains public void man_refresh() bing loaded? Initialize()?
"But if we run the same code from a dll by timer or by notification in socket, then we get the error:" Threading? From a windows form? Forms Timer or System Timer?
r,
dennis