Пример #1
0
        public void LoadFromFile()
        {
            var filename = _dialogCreator.AskForFileToOpen(Captions.LoadFavoritesFromFile, Constants.Filter.FAVORITES_FILE_FILTER, Constants.DirectoryKey.MODEL_PART);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            var favoritesFromFiles = _serializationTask.Load <Favorites>(filename);

            if (favoritesFromFiles == null)
            {
                return;
            }
            _favoriteRepository.Clear();
            _favoriteRepository.AddFavorites(favoritesFromFiles);
            _eventPublisher.PublishEvent(new FavoritesLoadedEvent());
        }