private void UpdateModelProvider(IModelProvider newModelProvider) { var oldModelProvider = _document.ModelProvider; if (oldModelProvider != null) { _savedModels[oldModelProvider.GetType()] = oldModelProvider.Serialize(); } DetachFromModelProviderEvents(oldModelProvider); _document.ModelProvider = newModelProvider; AttachToModelProviderEvents(newModelProvider); string currentlySavedModel; if (newModelProvider != null && _savedModels.TryGetValue(newModelProvider.GetType(), out currentlySavedModel)) { newModelProvider.Deserialize(currentlySavedModel); } OnPropertyChanged("ModelBuilder"); }
private void UpdateModelProvider(IModelProvider newModelProvider) { var oldModelProvider = _document.ModelProvider; if (oldModelProvider != null) _savedModels[oldModelProvider.GetType()] = oldModelProvider.Serialize(); DetachFromModelProviderEvents(oldModelProvider); _document.ModelProvider = newModelProvider; AttachToModelProviderEvents(newModelProvider); string currentlySavedModel; if (newModelProvider != null && _savedModels.TryGetValue(newModelProvider.GetType(), out currentlySavedModel)) { newModelProvider.Deserialize(currentlySavedModel); } OnPropertyChanged("ModelBuilder"); }