HERE IS SUMMARY OF IMPORTANT CHANGES IN VERSION 4.9.3. IT'S RECOMMENDED TO READ THIS BEFORE YOU START DEALING WITH THE NEW VERSION.
The use of application callback doesn't abolish o.get_ErrorMsg(o.LastErrorCode) scheme to report error message to GUI, for example:
1. Application callback.
New GlobalSettings.ApplicationCallback property was added. Callback object assigned to this property intercepts errors in all MapWinGIS classes so there is no longer needed to assign GlobalCallback to individual instances. In some cases errors are reported to application callback ONLY so there is strong recommendation to use it in ANY MapWinGIS application, however small it may be. Here is the simplest implementation of callback in C#:// simplest implementation of callbackpublicclass MyCallback : ICallback { publicvoid Progress(string KeyOfSender, int Percent, string Message) { Debug.Print("{0}: {1}", Message, Percent); } publicvoid Error(string KeyOfSender, string ErrorMsg) { Debug.Print("MapWinGIS error: ", ErrorMsg); } } // let's assign this callback as early as possible during app's execution:var gs = new GlobalSettings(); gs.ApplicationCallback = new MyCallback();
The use of application callback doesn't abolish o.get_ErrorMsg(o.LastErrorCode) scheme to report error message to GUI, for example:
var sf = new Shapefile(); if (!sf.Open(@"d:\my_data.shp")) { MessageBox.Show("Failed to open shapefile: " + sf.get_ErrorMsg(sf.LastErrorCode)); }