async public Task <bool> LoadAsync(IPersistStream stream) { while (_maps.Count > 0) { this.RemoveMap((IMap)_maps[0]); } _focusMapIndex = (int)stream.Load("focusMapIndex", (int)0); IMap map; while ((map = (await stream.LoadAsync <IMap>("IMap", new gView.Framework.Carto.Map()))) != null) { this.AddMap(map); } if (_maps.Count > 0) { FocusMap = _maps[0]; } else { FocusMap = null; } if (this.Application is IGUIApplication) { stream.Load("Moduls", null, new ModulsPersists(this.Application as IMapApplication)); stream.Load("Tools", null, new ToolsPersist(this.Application as IGUIApplication)); stream.Load("Toolbars", null, new ToolbarsPersist(this.Application as IGUIApplication)); } _tableRelations = (TableRelations)stream.Load("TableRelations", new TableRelations(this), new TableRelations(this)); return(true); }
async public Task <bool> LoadAsync(IPersistStream stream) { while (_maps.Count > 0) { this.RemoveMap((IMap)_maps.First()); } IMap map; while ((map = (await stream.LoadAsync <IMap>("IMap", new gView.Framework.Carto.Map()))) != null) { this.AddMap(map); var modules = new ModulesPersists(map); stream.Load("Moduls", null, modules); _mapModules.TryAdd(map, modules.Modules); } return(true); }