コード例 #1
0
ファイル: AddToFavsMenuItem.cs プロジェクト: rikoe/MEF.NET35
        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);
            }
        }
コード例 #2
0
        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);
            }
        }