コード例 #1
0
 public PackageManagerDialog(string path)
 {
     InitializeComponent();
     packageManagerProxy = new PackageManagerProxy();
     packageManagerProxy.PackageInstalling += packageManagerProxy_PackageInstalling;
     packageViewController = new PackageViewController(
         path,
         this,
         packageView,
         packageDetails,
         packagePageSelector,
         packageManagerProxy,
         packageIcons,
         searchComboBox,
         sortComboBox,
         releaseFilterComboBox,
         () => updatesNode.IsExpanded,
         value => multiOperationPanel.Visible = value,
         Enumerable.Empty <string>());
     InitializeRepositoryViewNodes();
     multiOperationPanel.Visible = false;
     multiOperationLabel.Text    = Resources.MultipleUpdatesLabel;
     multiOperationButton.Text   = Resources.MultipleUpdatesOperationName;
     DefaultTab = PackageManagerTab.Online;
 }
コード例 #2
0
ファイル: GalleryDialog.cs プロジェクト: aalmada/bonsai
 public GalleryDialog(string path)
 {
     InitializeComponent();
     packageManagerProxy = new PackageManagerProxy();
     packageManagerProxy.PackageInstalling += packageManagerProxy_PackageInstalling;
     packageViewController = new PackageViewController(
         path,
         this,
         packageView,
         packageDetails,
         packagePageSelector,
         packageManagerProxy,
         packageIcons,
         searchComboBox,
         sortComboBox,
         releaseFilterComboBox,
         () => false,
         value => { },
         new[] { Constants.BonsaiDirectory, Constants.GalleryDirectory });
 }
コード例 #3
0
        public PackageViewController(
            string path,
            Control owner,
            PackageView view,
            PackageDetails details,
            PackagePageSelector pageSelector,
            PackageManagerProxy managerProxy,
            ImageList icons,
            CueBannerComboBox search,
            ComboBox sort,
            ComboBox releaseFilter,
            Func <bool> updateFeed,
            Action <bool> multiOperationVisible,
            IEnumerable <string> tagConstraints)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            if (details == null)
            {
                throw new ArgumentNullException("details");
            }
            if (pageSelector == null)
            {
                throw new ArgumentNullException("pageSelector");
            }
            if (managerProxy == null)
            {
                throw new ArgumentNullException("managerProxy");
            }
            if (icons == null)
            {
                throw new ArgumentNullException("icons");
            }
            if (search == null)
            {
                throw new ArgumentNullException("search");
            }
            if (sort == null)
            {
                throw new ArgumentNullException("sort");
            }
            if (releaseFilter == null)
            {
                throw new ArgumentNullException("releaseFilter");
            }
            if (updateFeed == null)
            {
                throw new ArgumentNullException("updateFeed");
            }
            if (multiOperationVisible == null)
            {
                throw new ArgumentNullException("multiOperationVisible");
            }
            if (tagConstraints == null)
            {
                throw new ArgumentNullException("tagConstraints");
            }

            control                                     = owner;
            packageView                                 = view;
            packageDetails                              = details;
            packagePageSelector                         = pageSelector;
            packageManagerProxy                         = managerProxy;
            packageIcons                                = icons;
            searchComboBox                              = search;
            sortComboBox                                = sort;
            releaseFilterComboBox                       = releaseFilter;
            getUpdateFeed                               = updateFeed;
            setMultiOperationVisible                    = multiOperationVisible;
            tagSearchTerms                              = tagConstraints;
            control.KeyDown                            += control_KeyDown;
            packageView.AfterSelect                    += packageView_AfterSelect;
            sortComboBox.SelectedIndexChanged          += filterComboBox_SelectedIndexChanged;
            releaseFilterComboBox.SelectedIndexChanged += filterComboBox_SelectedIndexChanged;
            packagePageSelector.SelectedIndexChanged   += packagePageSelector_SelectedIndexChanged;

            packageManagerPath = path;
            iconCache          = new ConcurrentDictionary <Uri, IObservable <Image> >();
            defaultIcon        = GetPackageIcon(PackageDefaultIconUrl);

            activeRequests = new List <IDisposable>();
            var machineWideSettings = new BonsaiMachineWideSettings();
            var settings            = Settings.LoadDefaultSettings(new PhysicalFileSystem(AppDomain.CurrentDomain.BaseDirectory), null, machineWideSettings);

            packageSourceProvider    = new PackageSourceProvider(settings);
            packageManagers          = CreatePackageManagers();
            searchComboBox.CueBanner = Resources.SearchOnlineCueBanner;

            sortComboBox.Items.Add(SortByMostDownloads);
            sortComboBox.Items.Add(SortByPublishedDate);
            sortComboBox.Items.Add(SortByNameAscending);
            sortComboBox.Items.Add(SortByNameDescending);
            sortComboBox.SelectedIndex          = 0;
            releaseFilterComboBox.SelectedIndex = 0;
        }