Пример #1
0
        public override void OnClose()
        {
            mPackageMakerApp.Dispose();
            mPackageMakerApp = null;

            mDisposableList.Dispose();
            mDisposableList = null;
        }
Пример #2
0
        protected override void Init()
        {
            PackageMakerState.InitState();

            RootLayout = new VerticalLayout("box");

            var editorView    = new VerticalLayout().AddTo(RootLayout);
            var uploadingView = new VerticalLayout().AddTo(RootLayout);
            // var finishView = new VerticalLayout().AddTo(RootLayout);

            // 当前版本号
            var versionLine = new HorizontalLayout().AddTo(editorView);

            new LabelView("当前版本号").Width(100).AddTo(versionLine);
            new LabelView(mPackageVersion.Version).Width(100).AddTo(versionLine);

            // 发布版本号
            var publishedVertionLine = new HorizontalLayout().AddTo(editorView);

            new LabelView("发布版本号").Width(100).AddTo(publishedVertionLine);

            var version = new TextView().Width(100).AddTo(publishedVertionLine);

            // 类型
            var typeLine = new HorizontalLayout().AddTo(editorView);

            new LabelView("类型").Width(100).AddTo(typeLine);

            var packageType = new EnumPopupView(mPackageVersion.Type).AddTo(typeLine);

            var accessRightLine = new HorizontalLayout().AddTo(editorView);

            new LabelView("权限").Width(100).AddTo(accessRightLine);
            var accessRight = new EnumPopupView(mPackageVersion.AccessRight).AddTo(accessRightLine);

            new LabelView("发布说明:").Width(150).AddTo(editorView);

            var releaseNote = new TextAreaView().Width(250).Height(300).AddTo(editorView);

            PackageMakerState.InEditorView.BindWithInitialValue(value =>
            {
                editorView.Visible = value;
            }).AddTo(mDisposableList);

            if (User.Logined)
            {
                var publishBtn = new ButtonView("发布").AddTo(editorView);

                new ButtonView("发布并删除本地", () => { }).AddTo(editorView);

                publishBtn.OnClick.AddListener(() =>
                {
                    mPackageVersion.Readme.content = releaseNote.Content.Value;
                    mPackageVersion.AccessRight    = (PackageAccessRight)accessRight.ValueProperty.Value;
                    mPackageVersion.Type           = (PackageType)packageType.ValueProperty.Value;
                    mPackageVersion.Version        = version.Content.Value;

                    PackageMakerApp.Send(new PublishPackageCommand(mPackageVersion));
                });
            }

            var notice = new LabelViewWithRect("", 100, 200, 200, 200).AddTo(uploadingView);

            PackageMakerState.NoticeMessage
            .BindWithInitialValue(value =>
            {
                notice.Content.Value = value;
            }).AddTo(mDisposableList);

            PackageMakerState.InUploadingView.BindWithInitialValue(value =>
            {
                uploadingView.Visible = value;
            }).AddTo(mDisposableList);
        }