示例#1
0
        public ListViewFilter()
        {
            text.SetFocus();
            text.SetCompletions(typeof(T).GetProperties().Select(p => p.Name).ToArray <string> ());
            text.Activated += (sender, e) => Refresh();

            PackStart(text);
            PackStart(filterList, true);
        }
示例#2
0
        protected SearchDialog(IController <T> controller)
        {
            Controller = controller;
            Title      = Application.TranslationCatalog.GetString("Search");
            search.SetFocus();
            search.SetCompletions(typeof(T).GetPropertiesNames());

            refresh.Clicked += delegate {
                search.Text = string.Empty;
                if (Controller != null)
                {
                    Controller.Reload = true;
                }
                Refresh();
            };

            clearFilter.Clicked += (sender, e) => ResetFilter_Clicked();

            search.Activated += delegate {
                search.BackgroundColor = search.Text == string.Empty ? Colors.White : Colors.LightGreen;
                Refresh();
            };

            search.Changed += delegate {
                search.BackgroundColor = Colors.White;
                if (search.Text == string.Empty)
                {
                    Refresh();
                }
            };

            listView.RowActivated += delegate {
                var current = listView.SelectedRow;
                SelectedItem = store.GetValue(current, itemDataField);
                Respond(Command.Ok);
            };

            actionBox.PackStart(refresh, true);
            actionBox.PackStart(clearFilter, true);

            var dialogoVBox = new VBox();

            dialogoVBox.PackStart(new Label(Application.TranslationCatalog.GetString("Text search")));
            dialogoVBox.PackStart(search);
            dialogoVBox.PackStart(filtersBox);
            dialogoVBox.PackStart(listView, true, true);
            dialogoVBox.PackStart(result);
            dialogoVBox.PackEnd(actionBox);

            Width   = 700;
            Content = dialogoVBox;
        }
示例#3
0
 void AllCheckBoxClicked(object sender, EventArgs e)
 {
     listBox.Sensitive = !allCheckBox.Active;
     search.Sensitive  = !allCheckBox.Active;
     search.Text       = string.Empty;
     if (allCheckBox.Active && SelectionMode == SelectionMode.Multiple)
     {
         listBox.SelectAll();
     }
     else
     {
         listBox.UnselectAll();
     }
     OnSelectionItemChanged(e);
     if (!allCheckBox.Active)
     {
         search.SetFocus();
     }
 }
        void Build()
        {
            Title   = GettextCatalog.GetString("Add Packages");
            Width   = 820;
            Height  = 520;
            Padding = new WidgetSpacing();

            // Top part of dialog:
            // Package sources and search.
            var topHBox = new HBox();

            topHBox.Margin = new WidgetSpacing(8, 5, 6, 5);

            packageSourceComboBox          = new ComboBox();
            packageSourceComboBox.MinWidth = 200;
            topHBox.PackStart(packageSourceComboBox);

            packageSearchEntry = new SearchTextEntry();
            packageSearchEntry.WidthRequest = 187;
            topHBox.PackEnd(packageSearchEntry);

            this.HeaderContent = topHBox;

            // Middle of dialog:
            // Packages and package information.
            var mainVBox = new VBox();

            Content = mainVBox;

            var middleHBox = new HBox();

            middleHBox.Spacing = 0;
            var middleFrame = new FrameBox();

            middleFrame.Content     = middleHBox;
            middleFrame.BorderWidth = new WidgetSpacing(0, 0, 0, 1);
            middleFrame.BorderColor = lineBorderColor;
            mainVBox.PackStart(middleFrame, true, true);

            // Error information.
            var packagesListVBox = new VBox();

            packagesListVBox.Spacing         = 0;
            errorMessageHBox                 = new HBox();
            errorMessageHBox.Margin          = new WidgetSpacing();
            errorMessageHBox.BackgroundColor = Colors.Orange;
            errorMessageHBox.Visible         = false;
            var errorImage = new ImageView();

            errorImage.Margin = new WidgetSpacing(10, 0, 0, 0);
            errorImage.Image  = ImageService.GetIcon(Stock.Warning, Gtk.IconSize.Menu);
            errorImage.HorizontalPlacement = WidgetPlacement.End;
            errorMessageHBox.PackStart(errorImage);
            errorMessageLabel           = new Label();
            errorMessageLabel.TextColor = Colors.White;
            errorMessageLabel.Margin    = new WidgetSpacing(5, 5, 5, 5);
            errorMessageLabel.Wrap      = WrapMode.Word;
            errorMessageHBox.PackStart(errorMessageLabel, true);
            packagesListVBox.PackStart(errorMessageHBox);

            // Packages list.
            middleHBox.PackStart(packagesListVBox, true, true);
            packagesListView = new ListView();
            packagesListView.BorderVisible  = false;
            packagesListView.HeadersVisible = false;
            packagesListVBox.PackStart(packagesListView, true, true);

            // Loading spinner.
            var loadingSpinnerHBox = new HBox();

            loadingSpinnerHBox.HorizontalPlacement = WidgetPlacement.Center;
            var loadingSpinner = new Spinner();

            loadingSpinner.Animate  = true;
            loadingSpinner.MinWidth = 20;
            loadingSpinnerHBox.PackStart(loadingSpinner);

            loadingSpinnerLabel      = new Label();
            loadingSpinnerLabel.Text = GettextCatalog.GetString("Loading package list...");
            loadingSpinnerHBox.PackEnd(loadingSpinnerLabel);

            loadingSpinnerFrame                 = new FrameBox();
            loadingSpinnerFrame.Visible         = false;
            loadingSpinnerFrame.BackgroundColor = Colors.White;
            loadingSpinnerFrame.Content         = loadingSpinnerHBox;
            loadingSpinnerFrame.BorderWidth     = new WidgetSpacing();
            packagesListVBox.PackStart(loadingSpinnerFrame, true, true);

            // No packages found label.
            var noPackagesFoundHBox = new HBox();

            noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

            var noPackagesFoundLabel = new Label();

            noPackagesFoundLabel.Text = GettextCatalog.GetString("No matching packages found.");
            noPackagesFoundHBox.PackEnd(noPackagesFoundLabel);

            noPackagesFoundFrame                 = new FrameBox();
            noPackagesFoundFrame.Visible         = false;
            noPackagesFoundFrame.BackgroundColor = Colors.White;
            noPackagesFoundFrame.Content         = noPackagesFoundHBox;
            noPackagesFoundFrame.BorderWidth     = new WidgetSpacing();
            packagesListVBox.PackStart(noPackagesFoundFrame, true, true);

            // Package information
            packageInfoVBox = new VBox();
            var packageInfoFrame = new FrameBox();

            packageInfoFrame.BackgroundColor = packageInfoBackgroundColor;
            packageInfoFrame.BorderWidth     = new WidgetSpacing();
            packageInfoFrame.Content         = packageInfoVBox;
            packageInfoVBox.Margin           = new WidgetSpacing(15, 12, 15, 12);
            var packageInfoContainerVBox = new VBox();

            packageInfoContainerVBox.WidthRequest = 240;
            packageInfoContainerVBox.PackStart(packageInfoFrame, true, true);

            var packageInfoScrollView = new ScrollView();

            packageInfoScrollView.BorderVisible          = false;
            packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
            packageInfoScrollView.Content         = packageInfoContainerVBox;
            packageInfoScrollView.BackgroundColor = packageInfoBackgroundColor;
            var packageInfoScrollViewFrame = new FrameBox();

            packageInfoScrollViewFrame.BackgroundColor = packageInfoBackgroundColor;
            packageInfoScrollViewFrame.BorderWidth     = new WidgetSpacing(1, 0, 0, 0);
            packageInfoScrollViewFrame.BorderColor     = lineBorderColor;
            packageInfoScrollViewFrame.Content         = packageInfoScrollView;
            middleHBox.PackEnd(packageInfoScrollViewFrame);

            // Package name and version.
            var packageNameHBox = new HBox();

            packageInfoVBox.PackStart(packageNameHBox);

            packageNameLabel           = new Label();
            packageNameLabel.Ellipsize = EllipsizeMode.End;
            Font packageInfoSmallFont = packageNameLabel.Font.WithScaledSize(0.8);

            packageNameHBox.PackStart(packageNameLabel, true);

            packageVersionLabel = new Label();
            packageVersionLabel.TextAlignment = Alignment.End;
            packageNameHBox.PackEnd(packageVersionLabel);

            // Package description.
            packageDescription                 = new Label();
            packageDescription.Wrap            = WrapMode.Word;
            packageDescription.Font            = packageNameLabel.Font.WithScaledSize(0.9);
            packageDescription.BackgroundColor = packageInfoBackgroundColor;
            packageInfoVBox.PackStart(packageDescription);

            // Package id.
            var packageIdHBox = new HBox();

            packageIdHBox.MarginTop = 7;
            packageInfoVBox.PackStart(packageIdHBox);

            var packageIdLabel = new Label();

            packageIdLabel.Font   = packageInfoSmallFont;
            packageIdLabel.Markup = GettextCatalog.GetString("<b>Id</b>");
            packageIdHBox.PackStart(packageIdLabel);

            packageId                   = new Label();
            packageId.Ellipsize         = EllipsizeMode.End;
            packageId.TextAlignment     = Alignment.End;
            packageId.Font              = packageInfoSmallFont;
            packageIdLink               = new LinkLabel();
            packageIdLink.Ellipsize     = EllipsizeMode.End;
            packageIdLink.TextAlignment = Alignment.End;
            packageIdLink.Font          = packageInfoSmallFont;
            packageIdHBox.PackEnd(packageIdLink, true);
            packageIdHBox.PackEnd(packageId, true);

            // Package author
            var packageAuthorHBox = new HBox();

            packageInfoVBox.PackStart(packageAuthorHBox);

            var packageAuthorLabel = new Label();

            packageAuthorLabel.Markup = GettextCatalog.GetString("<b>Author</b>");
            packageAuthorLabel.Font   = packageInfoSmallFont;
            packageAuthorHBox.PackStart(packageAuthorLabel);

            packageAuthor = new Label();
            packageAuthor.TextAlignment = Alignment.End;
            packageAuthor.Ellipsize     = EllipsizeMode.End;
            packageAuthor.Font          = packageInfoSmallFont;
            packageAuthorHBox.PackEnd(packageAuthor, true);

            // Package published
            var packagePublishedHBox = new HBox();

            packageInfoVBox.PackStart(packagePublishedHBox);

            var packagePublishedLabel = new Label();

            packagePublishedLabel.Markup = GettextCatalog.GetString("<b>Published</b>");
            packagePublishedLabel.Font   = packageInfoSmallFont;
            packagePublishedHBox.PackStart(packagePublishedLabel);

            packagePublishedDate      = new Label();
            packagePublishedDate.Font = packageInfoSmallFont;
            packagePublishedHBox.PackEnd(packagePublishedDate);

            // Package downloads
            var packageDownloadsHBox = new HBox();

            packageInfoVBox.PackStart(packageDownloadsHBox);

            var packageDownloadsLabel = new Label();

            packageDownloadsLabel.Markup = GettextCatalog.GetString("<b>Downloads</b>");
            packageDownloadsLabel.Font   = packageInfoSmallFont;
            packageDownloadsHBox.PackStart(packageDownloadsLabel);

            packageDownloads      = new Label();
            packageDownloads.Font = packageInfoSmallFont;
            packageDownloadsHBox.PackEnd(packageDownloads);

            // Package license.
            var packageLicenseHBox = new HBox();

            packageInfoVBox.PackStart(packageLicenseHBox);

            var packageLicenseLabel = new Label();

            packageLicenseLabel.Markup = GettextCatalog.GetString("<b>License</b>");
            packageLicenseLabel.Font   = packageInfoSmallFont;
            packageLicenseHBox.PackStart(packageLicenseLabel);

            packageLicenseLink      = new LinkLabel();
            packageLicenseLink.Text = GettextCatalog.GetString("View License");
            packageLicenseLink.Font = packageInfoSmallFont;
            packageLicenseHBox.PackEnd(packageLicenseLink);

            // Package project page.
            var packageProjectPageHBox = new HBox();

            packageInfoVBox.PackStart(packageProjectPageHBox);

            var packageProjectPageLabel = new Label();

            packageProjectPageLabel.Markup = GettextCatalog.GetString("<b>Project Page</b>");
            packageProjectPageLabel.Font   = packageInfoSmallFont;
            packageProjectPageHBox.PackStart(packageProjectPageLabel);

            packageProjectPageLink      = new LinkLabel();
            packageProjectPageLink.Text = GettextCatalog.GetString("Visit Page");
            packageProjectPageLink.Font = packageInfoSmallFont;
            packageProjectPageHBox.PackEnd(packageProjectPageLink);

            // Package dependencies
            var packageDependenciesHBox = new HBox();

            packageInfoVBox.PackStart(packageDependenciesHBox);

            var packageDependenciesLabel = new Label();

            packageDependenciesLabel.Markup = GettextCatalog.GetString("<b>Dependencies</b>");
            packageDependenciesLabel.Font   = packageInfoSmallFont;
            packageDependenciesHBox.PackStart(packageDependenciesLabel);

            packageDependenciesNoneLabel      = new Label();
            packageDependenciesNoneLabel.Text = GettextCatalog.GetString("None");
            packageDependenciesNoneLabel.Font = packageInfoSmallFont;
            packageDependenciesHBox.PackEnd(packageDependenciesNoneLabel);

            // Package dependencies list.
            packageDependenciesListHBox         = new HBox();
            packageDependenciesListHBox.Visible = false;
            packageInfoVBox.PackStart(packageDependenciesListHBox);

            packageDependenciesList        = new Label();
            packageDependenciesList.Wrap   = WrapMode.WordAndCharacter;
            packageDependenciesList.Margin = new WidgetSpacing(5);
            packageDependenciesList.Font   = packageInfoSmallFont;
            packageDependenciesListHBox.PackStart(packageDependenciesList, true);

            // Bottom part of dialog:
            // Show pre-release packages and Close/Add to Project buttons.
            var bottomHBox = new HBox();

            bottomHBox.Margin  = new WidgetSpacing(8, 5, 14, 10);
            bottomHBox.Spacing = 5;
            mainVBox.PackStart(bottomHBox);

            showPrereleaseCheckBox       = new CheckBox();
            showPrereleaseCheckBox.Label = GettextCatalog.GetString("Show pre-release packages");
            bottomHBox.PackStart(showPrereleaseCheckBox);

            addPackagesButton           = new Button();
            addPackagesButton.MinWidth  = 120;
            addPackagesButton.MinHeight = 25;
            addPackagesButton.Label     = GettextCatalog.GetString("Add Package");
            bottomHBox.PackEnd(addPackagesButton);

            var closeButton = new Button();

            closeButton.MinWidth  = 120;
            closeButton.MinHeight = 25;
            closeButton.Label     = GettextCatalog.GetString("Close");
            closeButton.Clicked  += (sender, e) => Close();
            bottomHBox.PackEnd(closeButton);

            packageSearchEntry.SetFocus();
            packageInfoVBox.Visible = false;
        }
		void Build ()
		{
			Title = Catalog.GetString ("Add Packages");
			Width = 820;
			Height = 520;
			Padding = new WidgetSpacing ();

			// Top part of dialog:
			// Package sources and search.
			var topHBox = new HBox ();
			topHBox.Margin = new WidgetSpacing (8, 5, 6, 5);

			packageSourceComboBox = new ComboBox ();
			packageSourceComboBox.MinWidth = 200;
			topHBox.PackStart (packageSourceComboBox);

			packageSearchEntry = new SearchTextEntry ();
			packageSearchEntry.WidthRequest = 187;
			topHBox.PackEnd (packageSearchEntry);

			this.HeaderContent = topHBox;

			// Middle of dialog:
			// Packages and package information.
			var mainVBox = new VBox ();
			Content = mainVBox;

			var middleHBox = new HBox ();
			middleHBox.Spacing = 0;
			var middleFrame = new FrameBox ();
			middleFrame.Content = middleHBox;
			middleFrame.BorderWidth = new WidgetSpacing (0, 0, 0, 1);
			middleFrame.BorderColor = lineBorderColor;
			mainVBox.PackStart (middleFrame, true, true);

			// Error information.
			var packagesListVBox = new VBox ();
			packagesListVBox.Spacing = 0;
			errorMessageHBox = new HBox ();
			errorMessageHBox.Margin = new WidgetSpacing ();
			errorMessageHBox.BackgroundColor = Colors.Orange;
			errorMessageHBox.Visible = false;
			var errorImage = new ImageView ();
			errorImage.Margin = new WidgetSpacing (10, 0, 0, 0);
			errorImage.Image = ImageService.GetIcon (Stock.Warning, Gtk.IconSize.Menu);
			errorImage.HorizontalPlacement = WidgetPlacement.End;
			errorMessageHBox.PackStart (errorImage);
			errorMessageLabel = new Label ();
			errorMessageLabel.TextColor = Colors.White;
			errorMessageLabel.Margin = new WidgetSpacing (5, 5, 5, 5);
			errorMessageLabel.Wrap = WrapMode.Word;
			errorMessageHBox.PackStart (errorMessageLabel, true);
			packagesListVBox.PackStart (errorMessageHBox);

			// Packages list.
			middleHBox.PackStart (packagesListVBox, true, true);
			packagesListView = new ListView ();
			packagesListView.BorderVisible = false;
			packagesListView.HeadersVisible = false;
			packagesListVBox.PackStart (packagesListView, true, true);

			// Loading spinner.
			var loadingSpinnerHBox = new HBox ();
			loadingSpinnerHBox.HorizontalPlacement = WidgetPlacement.Center;
			var loadingSpinner = new Spinner ();
			loadingSpinner.Animate = true;
			loadingSpinner.MinWidth = 20;
			loadingSpinnerHBox.PackStart (loadingSpinner);

			loadingSpinnerLabel = new Label ();
			loadingSpinnerLabel.Text = Catalog.GetString ("Loading package list...");
			loadingSpinnerHBox.PackEnd (loadingSpinnerLabel);

			loadingSpinnerFrame = new FrameBox ();
			loadingSpinnerFrame.Visible = false;
			loadingSpinnerFrame.BackgroundColor = Colors.White;
			loadingSpinnerFrame.Content = loadingSpinnerHBox;
			loadingSpinnerFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (loadingSpinnerFrame, true, true);

			// No packages found label.
			var noPackagesFoundHBox = new HBox ();
			noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

			var noPackagesFoundLabel = new Label ();
			noPackagesFoundLabel.Text = Catalog.GetString ("No matching packages found.");
			noPackagesFoundHBox.PackEnd (noPackagesFoundLabel);

			noPackagesFoundFrame = new FrameBox ();
			noPackagesFoundFrame.Visible = false;
			noPackagesFoundFrame.BackgroundColor = Colors.White;
			noPackagesFoundFrame.Content = noPackagesFoundHBox;
			noPackagesFoundFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (noPackagesFoundFrame, true, true);

			// Package information
			packageInfoVBox = new VBox ();
			var packageInfoFrame = new FrameBox ();
			packageInfoFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoFrame.BorderWidth = new WidgetSpacing ();
			packageInfoFrame.Content = packageInfoVBox;
			packageInfoVBox.Margin = new WidgetSpacing (15, 12, 15, 12);
			var packageInfoContainerVBox = new VBox ();
			packageInfoContainerVBox.WidthRequest = 240;
			packageInfoContainerVBox.PackStart (packageInfoFrame, true, true);

			var packageInfoScrollView = new ScrollView ();
			packageInfoScrollView.BorderVisible = false;
			packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
			packageInfoScrollView.Content = packageInfoContainerVBox;
			packageInfoScrollView.BackgroundColor = packageInfoBackgroundColor;
			var packageInfoScrollViewFrame = new FrameBox ();
			packageInfoScrollViewFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoScrollViewFrame.BorderWidth = new WidgetSpacing (1, 0, 0, 0);
			packageInfoScrollViewFrame.BorderColor = lineBorderColor;
			packageInfoScrollViewFrame.Content = packageInfoScrollView;
			middleHBox.PackEnd (packageInfoScrollViewFrame);

			// Package name and version.
			var packageNameHBox = new HBox ();
			packageInfoVBox.PackStart (packageNameHBox);

			packageNameLabel = new Label ();
			packageNameLabel.Ellipsize = EllipsizeMode.End;
			Font packageInfoSmallFont = packageNameLabel.Font.WithScaledSize (0.8);
			packageNameHBox.PackStart (packageNameLabel, true);

			packageVersionLabel = new Label ();
			packageVersionLabel.TextAlignment = Alignment.End;
			packageNameHBox.PackEnd (packageVersionLabel);

			// Package description.
			packageDescription = new Label ();
			packageDescription.Wrap = WrapMode.Word;
			packageDescription.Font = packageNameLabel.Font.WithScaledSize (0.9);
			packageDescription.BackgroundColor = packageInfoBackgroundColor;
			packageInfoVBox.PackStart (packageDescription);

			// Package id.
			var packageIdHBox = new HBox ();
			packageIdHBox.MarginTop = 7;
			packageInfoVBox.PackStart (packageIdHBox);

			var packageIdLabel = new Label ();
			packageIdLabel.Font = packageInfoSmallFont;
			packageIdLabel.Markup = Catalog.GetString ("<b>Id</b>");
			packageIdHBox.PackStart (packageIdLabel);

			packageId = new Label ();
			packageId.Ellipsize = EllipsizeMode.End;
			packageId.TextAlignment = Alignment.End;
			packageId.Font = packageInfoSmallFont;
			packageIdLink = new LinkLabel ();
			packageIdLink.Ellipsize = EllipsizeMode.End;
			packageIdLink.TextAlignment = Alignment.End;
			packageIdLink.Font = packageInfoSmallFont;
			packageIdHBox.PackEnd (packageIdLink, true);
			packageIdHBox.PackEnd (packageId, true);

			// Package author
			var packageAuthorHBox = new HBox ();
			packageInfoVBox.PackStart (packageAuthorHBox);

			var packageAuthorLabel = new Label ();
			packageAuthorLabel.Markup = Catalog.GetString ("<b>Author</b>");
			packageAuthorLabel.Font = packageInfoSmallFont;
			packageAuthorHBox.PackStart (packageAuthorLabel);

			packageAuthor = new Label ();
			packageAuthor.TextAlignment = Alignment.End;
			packageAuthor.Ellipsize = EllipsizeMode.End;
			packageAuthor.Font = packageInfoSmallFont;
			packageAuthorHBox.PackEnd (packageAuthor, true);

			// Package published
			var packagePublishedHBox = new HBox ();
			packageInfoVBox.PackStart (packagePublishedHBox);

			var packagePublishedLabel = new Label ();
			packagePublishedLabel.Markup = Catalog.GetString ("<b>Published</b>");
			packagePublishedLabel.Font = packageInfoSmallFont;
			packagePublishedHBox.PackStart (packagePublishedLabel);

			packagePublishedDate = new Label ();
			packagePublishedDate.Font = packageInfoSmallFont;
			packagePublishedHBox.PackEnd (packagePublishedDate);

			// Package downloads
			var packageDownloadsHBox = new HBox ();
			packageInfoVBox.PackStart (packageDownloadsHBox);

			var packageDownloadsLabel = new Label ();
			packageDownloadsLabel.Markup = Catalog.GetString ("<b>Downloads</b>");
			packageDownloadsLabel.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackStart (packageDownloadsLabel);

			packageDownloads = new Label ();
			packageDownloads.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackEnd (packageDownloads);

			// Package license.
			var packageLicenseHBox = new HBox ();
			packageInfoVBox.PackStart (packageLicenseHBox);

			var packageLicenseLabel = new Label ();
			packageLicenseLabel.Markup = Catalog.GetString ("<b>License</b>");
			packageLicenseLabel.Font = packageInfoSmallFont;
			packageLicenseHBox.PackStart (packageLicenseLabel);

			packageLicenseLink = new LinkLabel ();
			packageLicenseLink.Text = Catalog.GetString ("View License");
			packageLicenseLink.Font = packageInfoSmallFont;
			packageLicenseHBox.PackEnd (packageLicenseLink);

			// Package project page.
			var packageProjectPageHBox = new HBox ();
			packageInfoVBox.PackStart (packageProjectPageHBox);

			var packageProjectPageLabel = new Label ();
			packageProjectPageLabel.Markup = Catalog.GetString ("<b>Project Page</b>");
			packageProjectPageLabel.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackStart (packageProjectPageLabel);

			packageProjectPageLink = new LinkLabel ();
			packageProjectPageLink.Text = Catalog.GetString ("Visit Page");
			packageProjectPageLink.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackEnd (packageProjectPageLink);

			// Package dependencies
			var packageDependenciesHBox = new HBox ();
			packageInfoVBox.PackStart (packageDependenciesHBox);

			var packageDependenciesLabel = new Label ();
			packageDependenciesLabel.Markup = Catalog.GetString ("<b>Dependencies</b>");
			packageDependenciesLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackStart (packageDependenciesLabel);

			packageDependenciesNoneLabel = new Label ();
			packageDependenciesNoneLabel.Text = Catalog.GetString ("None");
			packageDependenciesNoneLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackEnd (packageDependenciesNoneLabel);

			// Package dependencies list.
			packageDependenciesListHBox = new HBox ();
			packageDependenciesListHBox.Visible = false;
			packageInfoVBox.PackStart (packageDependenciesListHBox);

			packageDependenciesList = new Label ();
			packageDependenciesList.Wrap = WrapMode.WordAndCharacter;
			packageDependenciesList.Margin = new WidgetSpacing (5);
			packageDependenciesList.Font = packageInfoSmallFont;
			packageDependenciesListHBox.PackStart (packageDependenciesList, true);

			// Bottom part of dialog:
			// Show pre-release packages and Close/Add to Project buttons.
			var bottomHBox = new HBox ();
			bottomHBox.Margin = new WidgetSpacing (8, 5, 14, 10);
			bottomHBox.Spacing = 5;
			mainVBox.PackStart (bottomHBox);

			showPrereleaseCheckBox = new CheckBox ();
			showPrereleaseCheckBox.Label = Catalog.GetString ("Show pre-release packages");
			bottomHBox.PackStart (showPrereleaseCheckBox);

			addPackagesButton = new Button ();
			addPackagesButton.MinWidth = 120;
			addPackagesButton.MinHeight = 25;
			addPackagesButton.Label = Catalog.GetString ("Add Package");
			bottomHBox.PackEnd (addPackagesButton);

			var closeButton = new Button ();
			closeButton.MinWidth = 120;
			closeButton.MinHeight = 25;
			closeButton.Label = Catalog.GetString ("Close");
			closeButton.Clicked += (sender, e) => Close ();
			bottomHBox.PackEnd (closeButton);

			packageSearchEntry.SetFocus ();
			packageInfoVBox.Visible = false;
		}
        void Build()
        {
            Title   = GettextCatalog.GetString("Manage NuGet Packages – Solution");
            Width   = 840;
            Height  = 528;
            Padding = new WidgetSpacing();

            if (Platform.IsWindows)
            {
                packageInfoFontSize = 9;
            }

            // Top part of dialog:
            // Package sources and search.
            var topHBox = new HBox();

            topHBox.Margin = new WidgetSpacing(8, 5, 6, 5);

            // HACK: VoiceOver does not work when using Accessible.Label so workaround this by using
            // Accessible.LabelWidget and hide the label since we do not need it.
            var packageSourceLabel = new Label();

            packageSourceLabel.Text    = GettextCatalog.GetString("Package source");
            packageSourceLabel.Visible = false;
            topHBox.PackStart(packageSourceLabel);

            packageSourceComboBox          = new ComboBox();
            packageSourceComboBox.Name     = "packageSourceComboBox";
            packageSourceComboBox.MinWidth = 200;
            // Does not work:
            //packageSourceComboBox.Accessible.Label = GettextCatalog.GetString ("Package source");
            packageSourceComboBox.Accessible.LabelWidget = packageSourceLabel;
            topHBox.PackStart(packageSourceComboBox);

            tabGroup = new HBox();

            int tabLabelMinWidth = 60;

            browseLabel            = new CustomButtonLabel();
            browseLabel.Text       = GettextCatalog.GetString("Browse");
            browseLabel.Tag        = browseLabel.Text;
            browseLabel.MinWidth   = tabLabelMinWidth;
            browseLabel.MarginLeft = 10;
            tabGroup.PackStart(browseLabel);

            installedLabel          = new CustomButtonLabel();
            installedLabel.Text     = GettextCatalog.GetString("Installed");
            installedLabel.Tag      = installedLabel.Text;
            installedLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(installedLabel);

            updatesLabel          = new CustomButtonLabel();
            updatesLabel.Text     = GettextCatalog.GetString("Updates");
            updatesLabel.Tag      = updatesLabel.Text;
            updatesLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(updatesLabel);

            consolidateLabel          = new CustomButtonLabel();
            consolidateLabel.Text     = GettextCatalog.GetString("Consolidate");
            consolidateLabel.Tag      = consolidateLabel.Text;
            consolidateLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(consolidateLabel);

            topHBox.PackStart(tabGroup);

            packageSearchEntry                  = new SearchTextEntry();
            packageSearchEntry.Name             = "managePackagesDialogSearchEntry";
            packageSearchEntry.WidthRequest     = 187;
            packageSearchEntry.PlaceholderText  = GettextCatalog.GetString("Search");
            packageSearchEntry.Accessible.Label = GettextCatalog.GetString("Package Search");
            topHBox.PackEnd(packageSearchEntry);

            this.HeaderContent = topHBox;

            // Middle of dialog:
            // Packages and package information.
            var mainVBox = new VBox();

            Content = mainVBox;

            var middleHBox = new HBox();

            middleHBox.Spacing = 0;
            var middleFrame = new FrameBox();

            middleFrame.Content     = middleHBox;
            middleFrame.BorderWidth = new WidgetSpacing(0, 0, 0, 1);
            middleFrame.BorderColor = Styles.LineBorderColor;
            mainVBox.PackStart(middleFrame, true, true);

            // Error information.
            var packagesListVBox = new VBox();

            packagesListVBox.Spacing         = 0;
            errorMessageHBox                 = new HBox();
            errorMessageHBox.Margin          = new WidgetSpacing();
            errorMessageHBox.BackgroundColor = Styles.ErrorBackgroundColor;
            errorMessageHBox.Visible         = false;
            var errorImage = new ImageView();

            errorImage.Margin = new WidgetSpacing(10, 0, 0, 0);
            errorImage.Image  = ImageService.GetIcon(MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            errorImage.HorizontalPlacement = WidgetPlacement.End;
            errorMessageHBox.PackStart(errorImage);
            errorMessageLabel           = new Label();
            errorMessageLabel.TextColor = Styles.ErrorForegroundColor;
            errorMessageLabel.Margin    = new WidgetSpacing(5, 5, 5, 5);
            errorMessageLabel.Wrap      = WrapMode.Word;
            errorMessageHBox.PackStart(errorMessageLabel, true);
            packagesListVBox.PackStart(errorMessageHBox);

            // Packages list.
            middleHBox.PackStart(packagesListVBox, true, true);
            packagesListView = new ListView();
            packagesListView.BorderVisible    = false;
            packagesListView.HeadersVisible   = false;
            packagesListView.Accessible.Label = GettextCatalog.GetString("Packages");
            packagesListVBox.PackStart(packagesListView, true, true);

            // Loading spinner.
            var loadingSpinnerHBox = new HBox();

            loadingSpinnerHBox.HorizontalPlacement = WidgetPlacement.Center;
            var loadingSpinner = new Spinner();

            loadingSpinner.Animate  = true;
            loadingSpinner.MinWidth = 20;
            loadingSpinnerHBox.PackStart(loadingSpinner);

            loadingSpinnerLabel      = new Label();
            loadingSpinnerLabel.Text = GettextCatalog.GetString("Loading package list...");
            loadingSpinnerHBox.PackEnd(loadingSpinnerLabel);

            loadingSpinnerFrame                 = new FrameBox();
            loadingSpinnerFrame.Visible         = false;
            loadingSpinnerFrame.BackgroundColor = Styles.BackgroundColor;
            loadingSpinnerFrame.Content         = loadingSpinnerHBox;
            loadingSpinnerFrame.BorderWidth     = new WidgetSpacing();
            packagesListVBox.PackStart(loadingSpinnerFrame, true, true);

            // No packages found label.
            var noPackagesFoundHBox = new HBox();

            noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

            noPackagesFoundLabel      = new Label();
            noPackagesFoundLabel.Text = GettextCatalog.GetString("No matching packages found.");
            noPackagesFoundHBox.PackEnd(noPackagesFoundLabel);

            noPackagesFoundFrame                 = new FrameBox();
            noPackagesFoundFrame.Visible         = false;
            noPackagesFoundFrame.BackgroundColor = Styles.BackgroundColor;
            noPackagesFoundFrame.Content         = noPackagesFoundHBox;
            noPackagesFoundFrame.BorderWidth     = new WidgetSpacing();
            packagesListVBox.PackStart(noPackagesFoundFrame, true, true);

            // Package information
            packageInfoVBox = new VBox();
            var packageInfoFrame = new FrameBox();

            packageInfoFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoFrame.BorderWidth     = new WidgetSpacing();
            packageInfoFrame.Content         = packageInfoVBox;
            packageInfoVBox.Margin           = new WidgetSpacing(15, 12, 15, 12);
            var packageInfoContainerVBox = new VBox();

            packageInfoContainerVBox.WidthRequest = 328;
            packageInfoContainerVBox.PackStart(packageInfoFrame, true, true);

            var packageInfoScrollView = new ScrollView();

            packageInfoScrollView.BorderVisible          = false;
            packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
            packageInfoScrollView.Content         = packageInfoContainerVBox;
            packageInfoScrollView.BackgroundColor = Styles.PackageInfoBackgroundColor;
            var packageInfoScrollViewFrame = new FrameBox();

            packageInfoScrollViewFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoScrollViewFrame.BorderWidth     = new WidgetSpacing(1, 0, 0, 0);
            packageInfoScrollViewFrame.BorderColor     = Styles.LineBorderColor;
            packageInfoScrollViewFrame.Content         = packageInfoScrollView;

            // Package name and version.
            packageNameHBox = new HBox();
            packageInfoVBox.PackStart(packageNameHBox);

            packageNameLabel           = new Label();
            packageNameLabel.Ellipsize = EllipsizeMode.End;
            Font packageInfoSmallFont = packageNameLabel.Font.WithSize(packageInfoFontSize);
            Font packageInfoBoldFont  = packageInfoSmallFont.WithWeight(FontWeight.Bold);

            packageNameLabel.Font = packageInfoSmallFont;
            packageNameHBox.PackStart(packageNameLabel, true);

            // Projects list view label.
            projectsListViewLabel                 = new Label();
            projectsListViewLabel.Wrap            = WrapMode.Word;
            projectsListViewLabel.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(projectsListViewLabel);

            // Projects list view.
            projectsListViewVBox        = new VBox();
            projectsListViewVBox.Margin = new WidgetSpacing();
            packageInfoVBox.PackStart(projectsListViewVBox, true, true);

            // Package description.
            packageDescription                 = new Label();
            packageDescription.Wrap            = WrapMode.Word;
            packageDescription.Font            = packageNameLabel.Font.WithSize(packageInfoFontSize);
            packageDescription.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(packageDescription);

            // Package id.
            var packageIdHBox = new HBox();

            packageIdHBox.MarginTop = 7;
            packageInfoVBox.PackStart(packageIdHBox);

            var packageIdLabel = new Label();

            packageIdLabel.Font = packageInfoBoldFont;
            packageIdLabel.Text = GettextCatalog.GetString("ID");
            packageIdHBox.PackStart(packageIdLabel);

            packageId                            = new Label();
            packageId.Ellipsize                  = EllipsizeMode.End;
            packageId.TextAlignment              = Alignment.End;
            packageId.Font                       = packageInfoSmallFont;
            packageId.Accessible.LabelWidget     = packageIdLabel;
            packageIdLink                        = new LinkLabel();
            packageIdLink.Ellipsize              = EllipsizeMode.End;
            packageIdLink.TextAlignment          = Alignment.End;
            packageIdLink.Font                   = packageInfoSmallFont;
            packageIdLink.Accessible.LabelWidget = packageIdLabel;
            packageIdHBox.PackEnd(packageIdLink, true);
            packageIdHBox.PackEnd(packageId, true);

            // Package author
            var packageAuthorHBox = new HBox();

            packageInfoVBox.PackStart(packageAuthorHBox);

            var packageAuthorLabel = new Label();

            packageAuthorLabel.Text = GettextCatalog.GetString("Author");
            packageAuthorLabel.Font = packageInfoBoldFont;
            packageAuthorHBox.PackStart(packageAuthorLabel);

            packageAuthor = new Label();
            packageAuthor.TextAlignment          = Alignment.End;
            packageAuthor.Ellipsize              = EllipsizeMode.End;
            packageAuthor.Font                   = packageInfoSmallFont;
            packageAuthor.Accessible.LabelWidget = packageAuthorLabel;
            packageAuthorHBox.PackEnd(packageAuthor, true);

            // Package published
            var packagePublishedHBox = new HBox();

            packageInfoVBox.PackStart(packagePublishedHBox);

            var packagePublishedLabel = new Label();

            packagePublishedLabel.Text = GettextCatalog.GetString("Published");
            packagePublishedLabel.Font = packageInfoBoldFont;
            packagePublishedHBox.PackStart(packagePublishedLabel);

            packagePublishedDate      = new Label();
            packagePublishedDate.Font = packageInfoSmallFont;
            packagePublishedDate.Accessible.LabelWidget = packagePublishedLabel;
            packagePublishedHBox.PackEnd(packagePublishedDate);

            // Package downloads
            var packageDownloadsHBox = new HBox();

            packageInfoVBox.PackStart(packageDownloadsHBox);

            var packageDownloadsLabel = new Label();

            packageDownloadsLabel.Text = GettextCatalog.GetString("Downloads");
            packageDownloadsLabel.Font = packageInfoBoldFont;
            packageDownloadsHBox.PackStart(packageDownloadsLabel);

            packageDownloads      = new Label();
            packageDownloads.Font = packageInfoSmallFont;
            packageDownloads.Accessible.LabelWidget = packageDownloadsLabel;
            packageDownloadsHBox.PackEnd(packageDownloads);

            // Package license.
            var packageLicenseHBox = new HBox();

            packageInfoVBox.PackStart(packageLicenseHBox);

            var packageLicenseLabel = new Label();

            packageLicenseLabel.Text = GettextCatalog.GetString("License");
            packageLicenseLabel.Font = packageInfoBoldFont;
            packageLicenseHBox.PackStart(packageLicenseLabel);

            packageLicenseLink      = new LinkLabel();
            packageLicenseLink.Text = GettextCatalog.GetString("View License");
            packageLicenseLink.Font = packageInfoSmallFont;
            packageLicenseHBox.PackEnd(packageLicenseLink);

            // Package project page.
            var packageProjectPageHBox = new HBox();

            packageInfoVBox.PackStart(packageProjectPageHBox);

            var packageProjectPageLabel = new Label();

            packageProjectPageLabel.Text = GettextCatalog.GetString("Project Page");
            packageProjectPageLabel.Font = packageInfoBoldFont;
            packageProjectPageHBox.PackStart(packageProjectPageLabel);

            packageProjectPageLink                  = new LinkLabel();
            packageProjectPageLink.Text             = GettextCatalog.GetString("Visit Page");
            packageProjectPageLink.Font             = packageInfoSmallFont;
            packageProjectPageLink.Accessible.Label = GettextCatalog.GetString("Visit Project Page");
            packageProjectPageHBox.PackEnd(packageProjectPageLink);

            // Package dependencies
            packageDependenciesHBox = new HBox();
            packageInfoVBox.PackStart(packageDependenciesHBox);

            var packageDependenciesLabel = new Label();

            packageDependenciesLabel.Text = GettextCatalog.GetString("Dependencies");
            packageDependenciesLabel.Font = packageInfoBoldFont;
            packageDependenciesHBox.PackStart(packageDependenciesLabel);

            packageDependenciesNoneLabel      = new Label();
            packageDependenciesNoneLabel.Text = GettextCatalog.GetString("None");
            packageDependenciesNoneLabel.Font = packageInfoSmallFont;
            packageDependenciesNoneLabel.Accessible.LabelWidget = packageDependenciesLabel;
            packageDependenciesHBox.PackEnd(packageDependenciesNoneLabel);

            // Package dependencies list.
            packageDependenciesListHBox         = new HBox();
            packageDependenciesListHBox.Visible = false;
            packageInfoVBox.PackStart(packageDependenciesListHBox);

            packageDependenciesList        = new Label();
            packageDependenciesList.Wrap   = WrapMode.WordAndCharacter;
            packageDependenciesList.Margin = new WidgetSpacing(5);
            packageDependenciesList.Font   = packageInfoSmallFont;
            packageDependenciesList.Accessible.LabelWidget = packageDependenciesLabel;
            packageDependenciesListHBox.PackStart(packageDependenciesList, true);

            // Current package version.
            currentPackageVersionHBox                 = new HBox();
            currentPackageVersionHBox.Spacing         = 15;
            currentPackageVersionHBox.Visible         = false;
            currentPackageVersionHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            currentPackageVersionHBox.Margin          = new WidgetSpacing(15, 0, 15, 0);
            currentPackageVersionLabel                = new Label();
            currentPackageVersionLabel.BoundsChanged += PackageVersionLabelBoundsChanged;
            currentPackageVersionLabel.Font           = packageInfoSmallFont;
            currentPackageVersionLabel.Text           = GettextCatalog.GetString("Current Version:");
            currentPackageVersionLabel.TextAlignment  = Alignment.End;
            currentPackageVersionHBox.PackStart(currentPackageVersionLabel);

            var currentPackageVersionWithInfoPopoverHBox = new HBox();

            currentPackageVersionWithInfoPopoverHBox.Margin  = new WidgetSpacing();
            currentPackageVersionWithInfoPopoverHBox.Spacing = 0;

            currentPackageVersion      = new Label();
            currentPackageVersion.Font = packageInfoSmallFont;
            currentPackageVersion.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersion);

            currentPackageVersionInfoPopoverWidget          = new InformationPopoverWidget();
            currentPackageVersionInfoPopoverWidget.Severity = Ide.Tasks.TaskSeverity.Information;
            currentPackageVersionInfoPopoverWidget.Margin   = new WidgetSpacing(5, 0, 0, 2);
            currentPackageVersionInfoPopoverWidget.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersionInfoPopoverWidget);

            currentPackageVersionHBox.PackStart(currentPackageVersionWithInfoPopoverHBox);

            // Package versions.
            packageVersionsHBox                 = new HBox();
            packageVersionsHBox.Visible         = false;
            packageVersionsHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageVersionsHBox.Margin          = new WidgetSpacing(15, 0, 15, 12);
            packageVersionsLabel                = new Label();
            packageVersionsLabel.Font           = packageInfoSmallFont;
            packageVersionsLabel.Text           = GettextCatalog.GetString("New Version:");
            packageVersionsLabel.TextAlignment  = Alignment.End;
            packageVersionsHBox.PackStart(packageVersionsLabel);

            packageVersionComboBox      = new ComboBox();
            packageVersionComboBox.Name = "packageVersionComboBox";
            packageVersionComboBox.Accessible.LabelWidget = packageVersionsLabel;
            packageVersionsHBox.Spacing = 15;
            packageVersionsHBox.PackStart(packageVersionComboBox, true, true);

            var packageInfoAndVersionsVBox = new VBox();

            packageInfoAndVersionsVBox.Margin          = new WidgetSpacing();
            packageInfoAndVersionsVBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoAndVersionsVBox.PackStart(packageInfoScrollViewFrame, true, true);
            packageInfoAndVersionsVBox.PackStart(currentPackageVersionHBox, false, false);
            packageInfoAndVersionsVBox.PackStart(packageVersionsHBox, false, false);
            middleHBox.PackEnd(packageInfoAndVersionsVBox);

            // Bottom part of dialog:
            // Show pre-release packages and Close/Add to Project buttons.
            var bottomHBox = new HBox();

            bottomHBox.Margin  = new WidgetSpacing(8, 5, 14, 10);
            bottomHBox.Spacing = 5;
            mainVBox.PackStart(bottomHBox);

            showPrereleaseCheckBox       = new CheckBox();
            showPrereleaseCheckBox.Name  = "managePackagesDialogShowPreReleaseCheckBox";
            showPrereleaseCheckBox.Label = GettextCatalog.GetString("Show pre-release packages");
            bottomHBox.PackStart(showPrereleaseCheckBox);

            addPackagesButton           = new Button();
            addPackagesButton.Name      = "managePackagesDialogAddPackageButton";
            addPackagesButton.MinWidth  = 120;
            addPackagesButton.MinHeight = 25;
            addPackagesButton.Label     = GettextCatalog.GetString("Add Package");
            bottomHBox.PackEnd(addPackagesButton);

            closeButton           = new Button();
            closeButton.Name      = "managePackagesDialogCloseButton";
            closeButton.MinWidth  = 120;
            closeButton.MinHeight = 25;
            closeButton.Label     = GettextCatalog.GetString("Close");
            bottomHBox.PackEnd(closeButton);

            packageSearchEntry.SetFocus();
            packageInfoVBox.Visible = false;
        }