예제 #1
0
 public void OnDispose()
 {
     mDisposableList.Dispose();
     mDisposableList         = null;
     mCategoriesSelectorView = null;
     mPackageManagerConfig.Dispose();
     mPackageManagerConfig = null;
 }
예제 #2
0
        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(() =>
                {
                    PackageManagerConfig.SendCommand(new ImportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber > installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Update).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerConfig.SendCommand(new UpdatePackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber == installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Reimport).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerConfig.SendCommand(new ReimportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber < installedPackage.VersionNumber)
            {
                new SpaceView(94).AddTo(this);
            }

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

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

            PackageManagerConfig.SendCommand <PackageManagerInitCommand>();

            mRootLayout = new VerticalLayout();

            new LabelView(LocaleText.FrameworkPackages).FontSize(12).AddTo(mRootLayout);

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

            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 => { PackageManagerConfig.SendCommand(new SearchCommand(key)); }).AddTo(mDisposableList);
            })
                );

            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;
                    PackageManagerConfig.SendCommand(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddTo(mDisposableList);
            });

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

            new PackageListHeaderView()
            .AddTo(verticalLayout);

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

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

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

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