public void Save(IPersistStream stream) { foreach (IMap map in _maps) { stream.Save("IMap", map); if (_mapModules.ContainsKey(map)) { var modules = _mapModules.ContainsKey(map); var modulePersits = new ModulesPersists(map); stream.Save("Moduls", new ModulesPersists(map) { Modules = _mapModules[map] }); } } }
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); }