コード例 #1
0
ファイル: NuGetViewModel.cs プロジェクト: widistef/nuget
        private void InitializePackageSources(PackageSourcesViewModel packageSourcesViewModel)
        {
            // Set the loading message and set Loading to true
            Loading        = true;
            LoadingMessage = this.Descriptor.LoadingMessage;

            // Setup the PackageSourceViewModel
            this.PackageSourcesViewModel = packageSourcesViewModel;
            this.SelectedFeedSourceItem  = this.PackageSourcesViewModel.ActiveFeedSource;
        }
コード例 #2
0
        /// <summary>
        /// Shows a custom NuGet-style gallery.
        /// </summary>
        /// <param name="galleryId">A gallery descriptor for the gallery</param>
        /// <param name="installRoot">Root path for installing packages.</param>
        /// <returns>Task that shows the gallery.</returns>
        public Task <bool?> ShowGallery(
            INuGetGalleryDescriptor descriptor,
            string installRoot)
        {
            var feedSource = new FeedSource(descriptor.FeedUri, descriptor.FeedName)
            {
                IsBuiltIn = true,
                FilterTag = descriptor.FilterTag,
            };

            var preferences = this.Host.GetExtensionSpecificPreferences(descriptor.PreferencesStore);
            IFeedSourceStore feedSourceStore;

            // we special case the NuGet gallery to use the system-wide NuGet store
            feedSourceStore = new NuGetFeedSourceStore(preferences);

            // Customize the custom gallery
            var packageSourcesViewModel = new PackageSourcesViewModel(new PackageSourcesModel(feedSource, feedSourceStore));

            var viewModel = new NuGetViewModel(
                descriptor,
                this.Host,
                packageSourcesViewModel,
                (sourceUrl, siteRoot) => new NuGetPackageManager(
                    sourceUrl,
                    siteRoot,
                    this.Host),
                installRoot,
                GetCurrentTaskScheduler());

            viewModel.ShouldShowPrereleaseFilter = true;

            return(Task.Factory.StartNew <bool?>(() =>
            {
                var view = new NuGetView(descriptor.DialogTitle);

                // show the gallery view
                view.DataContext = viewModel;

                return this.Host.ShowDialog(null, view);
            },
                                                 CancellationToken.None,
                                                 TaskCreationOptions.None,
                                                 GetCurrentTaskScheduler()));
        }
コード例 #3
0
ファイル: NuGetGallery.cs プロジェクト: Newtopian/nuget
        /// <summary>
        /// Shows a custom NuGet-style gallery.
        /// </summary>
        /// <param name="galleryId">A gallery descriptor for the gallery</param>
        /// <param name="installRoot">Root path for installing packages.</param>
        /// <returns>Task that shows the gallery.</returns>
        public Task<bool?> ShowGallery(
            INuGetGalleryDescriptor descriptor,
            string installRoot)
        {
            var feedSource = new FeedSource(descriptor.FeedUri, descriptor.FeedName)
            {
                IsBuiltIn = true,
                FilterTag = descriptor.FilterTag,
            };

            var preferences = this.Host.GetExtensionSpecificPreferences(descriptor.PreferencesStore);
            IFeedSourceStore feedSourceStore;

            // we special case the NuGet gallery to use the system-wide NuGet store
            feedSourceStore = new NuGetFeedSourceStore(preferences);

            // Customize the custom gallery
            var packageSourcesViewModel = new PackageSourcesViewModel(new PackageSourcesModel(feedSource, feedSourceStore));

            var viewModel = new NuGetViewModel(
                descriptor,
                this.Host,
                packageSourcesViewModel,
                (sourceUrl, siteRoot) => new NuGetPackageManager(
                        sourceUrl,
                        siteRoot,
                        this.Host),
                installRoot,
                GetCurrentTaskScheduler());

            viewModel.ShouldShowPrereleaseFilter = true;

            return Task.Factory.StartNew<bool?>(() =>
            {
                var view = new NuGetView(descriptor.DialogTitle);

                // show the gallery view
                view.DataContext = viewModel;

                return this.Host.ShowDialog(null, view);
            },
            CancellationToken.None,
            TaskCreationOptions.None,
            GetCurrentTaskScheduler());
        }
コード例 #4
0
ファイル: NuGetViewModel.cs プロジェクト: widistef/nuget
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetViewModel"/> class.
        /// </summary>
        public NuGetViewModel(
            INuGetGalleryDescriptor descriptor,
            IWebMatrixHost host,
            PackageSourcesViewModel packageSourcesViewModel,
            Func <Uri, string, INuGetPackageManager> packageManagerCreator,
            string destination,
            TaskScheduler scheduler)
        {
            this.Descriptor = descriptor;
            this.Host       = host;
            this.Scheduler  = scheduler;

            _packageManagerCreator        = packageManagerCreator;
            _destination                  = destination;
            _preferences                  = this.Host.GetExtensionSpecificPreferences(this.Descriptor.PreferencesStore);
            _selectedPrereleaseFilter     = LoadPrereleaseFilter();
            _includePrerelease            = (_selectedPrereleaseFilter == Resources.Prerelease_Filter_IncludePrerelease);
            PackagesToDisplayForUpdateAll = new List <PackageViewModel>();

            this.ShowDetailsPageCommand   = new RelayCommand(this.ShowDetailsPage, this.CanShowDetailsPage);
            this.ShowLicensePageCommand   = new RelayCommand(this.ShowLicensePage, this.CanShowLicensePage);
            this.ShowUninstallPageCommand = new RelayCommand(this.ShowUninstallPage, this.CanShowUninstallPage);

            this.ShowListCommand = new RelayCommand(this.ShowList, this.CanShowList);

            this.InstallCommand   = new RelayCommand(this.Install, this.CanInstall);
            this.UpdateCommand    = new RelayCommand(this.Update, this.CanUpdate);
            this.UninstallCommand = new RelayCommand(this.Uninstall, this.CanUninstall);

            this.UpdateAllCommand             = new RelayCommand(this.UpdateAll, this.CanUpdateAll);
            this.ShowLicensePageForAllCommand = new RelayCommand(this.ShowLicensePageForAll, this.CanShowLicensePageForAll);

            this.DisableCommand = new RelayCommand(this.Disable, this.CanDisable);
            this.EnableCommand  = new RelayCommand(this.Enable, this.CanEnable);

            this.DefaultActionCommand = new RelayCommand(this.DefaultAction, this.CanDefaultAction);

            // Initialize the Package Sources
            InitializePackageSources(packageSourcesViewModel);
        }
コード例 #5
0
ファイル: NuGetViewModel.cs プロジェクト: Newtopian/nuget
        /// <summary>
        /// Initializes a new instance of the <see cref="T:NuGetViewModel"/> class.
        /// </summary>
        public NuGetViewModel(
            INuGetGalleryDescriptor descriptor,
            IWebMatrixHost host,
            PackageSourcesViewModel packageSourcesViewModel, 
            Func<Uri, string, INuGetPackageManager> packageManagerCreator, 
            string destination,
            TaskScheduler scheduler)
        {
            this.Descriptor = descriptor;
            this.Host = host;
            this.Scheduler = scheduler;

            _packageManagerCreator = packageManagerCreator;
            _destination = destination;
            _preferences = this.Host.GetExtensionSpecificPreferences(this.Descriptor.PreferencesStore);
            _selectedPrereleaseFilter = LoadPrereleaseFilter();
            _includePrerelease = (_selectedPrereleaseFilter == Resources.Prerelease_Filter_IncludePrerelease);
            PackagesToDisplayForUpdateAll = new List<PackageViewModel>();

            this.ShowDetailsPageCommand = new RelayCommand(this.ShowDetailsPage, this.CanShowDetailsPage);
            this.ShowLicensePageCommand = new RelayCommand(this.ShowLicensePage, this.CanShowLicensePage);
            this.ShowUninstallPageCommand = new RelayCommand(this.ShowUninstallPage, this.CanShowUninstallPage);

            this.ShowListCommand = new RelayCommand(this.ShowList, this.CanShowList);

            this.InstallCommand = new RelayCommand(this.Install, this.CanInstall);
            this.UpdateCommand = new RelayCommand(this.Update, this.CanUpdate);
            this.UninstallCommand = new RelayCommand(this.Uninstall, this.CanUninstall);

            this.UpdateAllCommand = new RelayCommand(this.UpdateAll, this.CanUpdateAll);
            this.ShowLicensePageForAllCommand = new RelayCommand(this.ShowLicensePageForAll, this.CanShowLicensePageForAll);

            this.DisableCommand = new RelayCommand(this.Disable, this.CanDisable);
            this.EnableCommand = new RelayCommand(this.Enable, this.CanEnable);

            this.DefaultActionCommand = new RelayCommand(this.DefaultAction, this.CanDefaultAction);

            // Initialize the Package Sources
            InitializePackageSources(packageSourcesViewModel);
        }
コード例 #6
0
ファイル: NuGetViewModel.cs プロジェクト: Newtopian/nuget
        private void InitializePackageSources(PackageSourcesViewModel packageSourcesViewModel)
        {
            // Set the loading message and set Loading to true
            Loading = true;
            LoadingMessage = this.Descriptor.LoadingMessage;

            // Setup the PackageSourceViewModel
            this.PackageSourcesViewModel = packageSourcesViewModel;
            this.SelectedFeedSourceItem = this.PackageSourcesViewModel.ActiveFeedSource;
        }