Пример #1
0
        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");
        }
Пример #2
0
        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");
        }