public PackageRepositoryView(PackageRepository packageRepository)
        {
            new SpaceView(2).AddTo(this);

            new LabelView(packageRepository.name).FontBold().Width(200).AddTo(this);

            new LabelView(packageRepository.latestVersion).TextMiddleCenter().Width(80).AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(packageRepository.name);

            new LabelView(installedPackage != null ? installedPackage.Version : " ").TextMiddleCenter().Width(100)
            .AddTo(this);

            new LabelView(packageRepository.accessRight).TextMiddleLeft().Width(50).AddTo(this);


            if (installedPackage == null)
            {
                new ButtonView(LocaleText.Import).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerApp.Send(new ImportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber > installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Update).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerApp.Send(new UpdatePackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber == installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Reimport).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerApp.Send(new ReimportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber < installedPackage.VersionNumber)
            {
                new SpaceView(94).AddTo(this);
            }

            new ButtonView(LocaleText.ReleaseNotes)
            .Width(100)
            .AddTo(this)
            .OnClick.AddListener(() =>
            {
                PackageManagerApp.Send(new OpenDetailCommand(packageRepository));
            });

            new LabelView(packageRepository.author)
            .TextMiddleLeft()
            .FontBold().Width(100)
            .AddTo(this);
        }
        public void Init(IQFrameworkContainer container)
        {
            Container = container;

            PackageManagerApp.Send <PackageManagerInitCommand>();

            mRootLayout = new VerticalLayout();
            var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);

            var verticalLayout = new VerticalLayout("box");

            treeNode.Add2Spread(verticalLayout);

            var searchView = new HorizontalLayout("box")
                             .AddTo(verticalLayout);

            searchView.AddChild(new LabelView("搜索:")
                                .FontBold()
                                .FontSize(12)
                                .Width(40));

            searchView.AddChild(
                new TextView().Height(20)
                .Do(search =>
            {
                search.Content
                .Bind(key => { PackageManagerApp.Send(new SearchCommand(key)); }).AddTo(mDisposableList);
            })
                );

            mAccessRightView = new ToolbarView()
                               .Menus(new List <string>()
            {
                "all", PackageAccessRight.Public.ToString(), PackageAccessRight.Private.ToString()
            })
                               .AddTo(verticalLayout)
                               .Do(self =>
            {
                self.Index.Bind(value =>
                {
                    PackageManagerState.AccessRightIndex.Value = value;
                    PackageManagerApp.Send(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddTo(mDisposableList);
            });

            mCategoriesSelectorView = new ToolbarView()
                                      .AddTo(verticalLayout)
                                      .Do(self =>
            {
                self.Index.Bind(value =>
                {
                    PackageManagerState.CategoryIndex.Value = value;
                    PackageManagerApp.Send(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddTo(mDisposableList);
            });

            new PackageListHeaderView()
            .AddTo(verticalLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(verticalLayout);

            mRepositoryList = new ScrollLayout()
                              .Height(240)
                              .AddTo(packageList);

            PackageManagerState.Categories.Bind(value => { Categories = value; }).AddTo(mDisposableList);

            PackageManagerState.PackageRepositories
            .Bind(list => { this.PackageRepositories = list; }).AddTo(mDisposableList);
        }