protected override void Init()
        {
            RootLayout = new VerticalLayout("box");

            BindKit.Init();

            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);


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

            new LabelView("文档地址:").Width(52).AddTo(docLine);
            var docUrl = new TextView(mPackageVersion.DocUrl).Width(150).AddTo(docLine);



            var pasteBtn = new ButtonView("Paste").AddTo(docLine);


            var bindingSet = BindKit.CreateBindingSet(this, new PackageMakerViewModel(mPackageVersion));

            bindingSet.Bind(editorView).For(v => v.Visible).To(vm => vm.InEditorView);
            bindingSet.Bind(version.Content).For(v => v.Value, v => v.OnValueChanged)
            .To(vm => vm.Version);
            bindingSet.Bind(packageType.ValueProperty).For(v => v.Value, v => v.OnValueChanged)
            .To(vm => vm.Type);


            bindingSet.Bind(accessRight.ValueProperty)
            .For(v => v.Value, v => v.OnValueChanged)
            .To(vm => vm.AccessRight);

            bindingSet.Bind(releaseNote.Content).For(v => v.Value, v => v.OnValueChanged)
            .To(vm => vm.ReleaseNote);
            bindingSet.Bind(docUrl.Content).For(v => v.Value, v => v.OnValueChanged)
            .To(vm => vm.DocUrl);
            bindingSet.Bind(pasteBtn).For(v => v.OnClick).To(vm => vm.Paste);

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



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

                bindingSet.Bind(publishBtn).For(v => v.OnClick).To(vm => vm.Publish)
                .CommandParameter(mPackageVersion);
            }


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

            bindingSet.Bind(notice.Content).For(v => v.Value).To(vm => vm.NoticeMessage);

            bindingSet.Bind(uploadingView).For(v => v.Visible).To(vm => vm.InUploadingView);

            bindingSet.Build();
        }
Beispiel #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 publishedVersionLine = new HorizontalLayout().AddTo(editorView);

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

            new TextView(mPublishVersion)
            .Width(100)
            .AddTo(publishedVersionLine)
            .Content.Bind(v => mPublishVersion = v);

            // 类型
            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)
            {
                new ButtonView("发布", () =>
                {
                    mPackageVersion.Readme.content = releaseNote.Content.Value;
                    mPackageVersion.AccessRight    = (PackageAccessRight)accessRight.ValueProperty.Value;
                    mPackageVersion.Type           = (PackageType)packageType.ValueProperty.Value;
                    mPackageVersion.Version        = mPublishVersion;

                    mControllerNode.SendCommand(new PublishPackageCommand(mPackageVersion));
                }).AddTo(editorView);
            }

            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);
        }