private void AddToFavorites() { Debug.Assert(NavigationService != null); Debug.Assert(Container != null); string fullPath = System.IO.Path.Combine(NavigationService.CurrentPath, NavigationService.SelectedItem); IFavoriteItem favItem = null; if (Directory.Exists(fullPath)) { favItem = new FavoriteDirectoryItem(fullPath); } else if (File.Exists(fullPath)) { favItem = new FavoriteFileItem(fullPath); } if (favItem != null) { CompositionBatch batch = new CompositionBatch(); batch.AddPart(favItem); Container.Compose(batch); } }