private void InitControl() { var installedPackagesViewModel = new InstalledPackageViewModel(); installedPackagesViewModel.ActiveConnection = AppService.ActiveSharePointConnection; if (AppService.ActiveSharePointConnection != null) { cbSharePointConnection.SelectedItem = AppService.ActiveSharePointConnection; } ShBinder.NewBinder(MpCommands.Instance.FetchInstalledNuGetPackagesCommand) .BindProperty(o => o.Enabled, bRefresh, c => c.Enabled) .BindEvent(bRefresh, c => c.Click += (s, e) => RefreshInstalledPackages()); ShBinder.NewBinder(installedPackagesViewModel) .AutoBindProperty(o => o.ActiveConnection, cbSharePointConnection, SharePointConnectionsDataSource) .AutoBindProperty(o => o.SearchFilter, tbSearch) .AutoBindProperty(o => o.ShowWithUpdates, cbShowWithUpdates); Application.Idle += (s, e) => { UpdateNewPackages(); }; installedPackagesViewModel.PropertyChanged += (s, e) => { SelectedConnectionChanged(e); }; grData .AddDefaultNuGetPackageFields() .SetDefaultGridLookAndFeel() .SetDataSource(AppService.InstalledNuGetPackages); tsViewPackageDetails.Click += (s, e) => { if (SelectedPackage != null) { MpCommands.Instance.ShowNuGetPackageDetails(SelectedPackage); } }; grData.DoubleClick += (s, e) => { if (SelectedPackage != null) { MpCommands.Instance.ShowNuGetPackageDetails(SelectedPackage); } }; }
private void InitControl() { grData .AddDefaultNuGetPackageFields() .SetDefaultGridLookAndFeel() .SetDataSource(AppService.AvailableNuGetPackages); ShBinder.NewBinder(MpCommands.Instance.FetchAvailableNuGetPackagesCommand) .BindProperty(o => o.Enabled, bRefresh, c => c.Enabled) .BindEvent(bRefresh, c => c.Click += (s, e) => RefreshAvailablePackages()); tbSearch.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { RefreshAvailablePackages(tbSearch.Text, cbIncludePrerelease.Checked); } }; cbIncludePrerelease.CheckedChanged += (s, e) => { RefreshAvailablePackages(tbSearch.Text, cbIncludePrerelease.Checked); }; lRefresh.Click += (s, e) => { RefreshAvailablePackages(tbSearch.Text, cbIncludePrerelease.Checked); }; grData.DataSource = AppService.AvailableNuGetPackages; tsViewPackageDetails.Click += (s, e) => { if (SelectedPackage != null) { MpCommands.Instance.ShowNuGetPackageDetails(SelectedPackage); } }; tsDeployPackage.Click += (s, e) => { if (SelectedPackage != null) { MpCommands.Instance.ProvisionNuGetPackage(SelectedPackage); } }; grData.DoubleClick += (s, e) => { if (SelectedPackage != null) { MpCommands.Instance.ShowNuGetPackageDetails(SelectedPackage); } }; lAddNuGetConnection.Click += (s, e) => { MpCommands.Instance.NewNuGetGalleryConnection(); }; Application.Idle += (s, e) => { if (_tmpAllPackagesFetch) { WithSafeUIUpdate(() => { AppService.AvailableNuGetPackages.Clear(); AppService.AvailableNuGetPackages.AddRange(_tmpAllPackages); _tmpAllPackagesFetch = false; grData.Enabled = true; }); } }; }